mirror of
https://github.com/outbackdingo/amnezia-client.git
synced 2026-01-27 02:18:09 +00:00
fix: minor ui fixes (#1817)
* fix: minor ui fixes with services list * fix: fix page share connection headers and config description
This commit is contained in:
@@ -40,7 +40,7 @@ namespace PageLoader
|
||||
PageSettingsApiDevices,
|
||||
PageSettingsApiSubscriptionKey,
|
||||
PageSettingsKillSwitchExceptions,
|
||||
|
||||
|
||||
PageServiceSftpSettings,
|
||||
PageServiceTorWebsiteSettings,
|
||||
PageServiceDnsSettings,
|
||||
@@ -125,6 +125,8 @@ signals:
|
||||
void goToPageViewConfig();
|
||||
void goToPageSettingsServerServices();
|
||||
void goToPageSettingsBackup();
|
||||
void goToShareConnectionPage(QString headerText, QString configContentHeaderText, QString configCaption, QString configExtension,
|
||||
QString configFileName);
|
||||
|
||||
void closePage();
|
||||
|
||||
|
||||
@@ -117,6 +117,13 @@ QVariant ApiServicesModel::data(const QModelIndex &index, int role) const
|
||||
case EndDateRole: {
|
||||
return QDateTime::fromString(apiServiceData.subscription.endDate, Qt::ISODate).toLocalTime().toString("d MMM yyyy");
|
||||
}
|
||||
case OrderRole: {
|
||||
if (serviceType == serviceType::amneziaPremium) {
|
||||
return 0;
|
||||
} else if (serviceType == serviceType::amneziaFree) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
@@ -216,6 +223,7 @@ QHash<int, QByteArray> ApiServicesModel::roleNames() const
|
||||
roles[FeaturesRole] = "features";
|
||||
roles[PriceRole] = "price";
|
||||
roles[EndDateRole] = "endDate";
|
||||
roles[OrderRole] = "order";
|
||||
|
||||
return roles;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,8 @@ public:
|
||||
RegionRole,
|
||||
FeaturesRole,
|
||||
PriceRole,
|
||||
EndDateRole
|
||||
EndDateRole,
|
||||
OrderRole
|
||||
};
|
||||
|
||||
explicit ApiServicesModel(QObject *parent = nullptr);
|
||||
|
||||
@@ -218,9 +218,6 @@ PageType {
|
||||
ApiConfigsController.prepareVpnKeyExport()
|
||||
|
||||
PageController.showBusyIndicator(false)
|
||||
|
||||
// Navigate to PageShareConnection page
|
||||
//PageController.goToPage(PageEnum.PageShareConnection)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,14 +53,6 @@ PageType {
|
||||
Layout.leftMargin: 16
|
||||
Layout.rightMargin: 16
|
||||
|
||||
defaultColor: AmneziaStyle.color.paleGray
|
||||
hoveredColor: AmneziaStyle.color.sheerWhite
|
||||
pressedColor: AmneziaStyle.color.translucentWhite
|
||||
disabledColor: AmneziaStyle.color.mutedGray
|
||||
textColor: AmneziaStyle.color.black
|
||||
leftImageColor: "black"
|
||||
borderWidth: 1
|
||||
|
||||
text: qsTr("Copy key")
|
||||
leftImageSource: "qrc:/images/controls/copy.svg"
|
||||
|
||||
@@ -194,7 +186,7 @@ PageType {
|
||||
font.pixelSize: 16
|
||||
font.weight: Font.Medium
|
||||
font.family: "PT Root UI VF"
|
||||
text: ApiConfigsController.vpnKey //|| ""
|
||||
text: ApiConfigsController.vpnKey
|
||||
wrapMode: Text.Wrap
|
||||
background: Rectangle { color: AmneziaStyle.color.transparent }
|
||||
}
|
||||
|
||||
@@ -66,6 +66,8 @@ PageType {
|
||||
imageSource: imagePath
|
||||
leftText: lText
|
||||
rightText: rText
|
||||
|
||||
visible: isVisible
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Dialogs
|
||||
|
||||
import SortFilterProxyModel 0.2
|
||||
|
||||
import PageEnum 1.0
|
||||
import Style 1.0
|
||||
|
||||
@@ -54,7 +56,15 @@ PageType {
|
||||
|
||||
spacing: 0
|
||||
|
||||
model: ApiServicesModel
|
||||
model: SortFilterProxyModel {
|
||||
id: proxyApiServicesModel
|
||||
|
||||
sourceModel: ApiServicesModel
|
||||
sorters: RoleSorter {
|
||||
roleName: "order"
|
||||
sortOrder: Qt.AscendingOrder
|
||||
}
|
||||
}
|
||||
|
||||
delegate: ColumnLayout {
|
||||
|
||||
@@ -78,7 +88,7 @@ PageType {
|
||||
|
||||
onClicked: {
|
||||
if (isServiceAvailable) {
|
||||
ApiServicesModel.setServiceIndex(index)
|
||||
ApiServicesModel.setServiceIndex(proxyApiServicesModel.mapToSource(index))
|
||||
PageController.goToPage(PageEnum.PageSetupWizardApiServiceInfo)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,40 +45,67 @@ PageType {
|
||||
function onGenerateConfig(type) {
|
||||
PageController.showBusyIndicator(true)
|
||||
|
||||
var configCaption
|
||||
var configExtension
|
||||
var configFileName
|
||||
|
||||
switch (type) {
|
||||
case PageShare.ConfigType.AmneziaConnection: {
|
||||
ExportController.generateConnectionConfig(clientNameTextField.textField.text);
|
||||
configCaption = qsTr("Save AmneziaVPN config")
|
||||
configExtension = ".vpn"
|
||||
configFileName = "amnezia_config"
|
||||
break;
|
||||
}
|
||||
case PageShare.ConfigType.OpenVpn: {
|
||||
ExportController.generateOpenVpnConfig(clientNameTextField.textField.text)
|
||||
configCaption = qsTr("Save OpenVPN config")
|
||||
configExtension = ".ovpn"
|
||||
configFileName = "amnezia_for_openvpn"
|
||||
break
|
||||
}
|
||||
case PageShare.ConfigType.WireGuard: {
|
||||
ExportController.generateWireGuardConfig(clientNameTextField.textField.text)
|
||||
configCaption = qsTr("Save WireGuard config")
|
||||
configExtension = ".conf"
|
||||
configFileName = "amnezia_for_wireguard"
|
||||
break
|
||||
}
|
||||
case PageShare.ConfigType.Awg: {
|
||||
ExportController.generateAwgConfig(clientNameTextField.textField.text)
|
||||
configCaption = qsTr("Save AmneziaWG config")
|
||||
configExtension = ".conf"
|
||||
configFileName = "amnezia_for_awg"
|
||||
break
|
||||
}
|
||||
case PageShare.ConfigType.ShadowSocks: {
|
||||
ExportController.generateShadowSocksConfig()
|
||||
configCaption = qsTr("Save Shadowsocks config")
|
||||
configExtension = ".json"
|
||||
configFileName = "amnezia_for_shadowsocks"
|
||||
break
|
||||
}
|
||||
case PageShare.ConfigType.Cloak: {
|
||||
ExportController.generateCloakConfig()
|
||||
configCaption = qsTr("Save Cloak config")
|
||||
configExtension = ".json"
|
||||
configFileName = "amnezia_for_cloak"
|
||||
break
|
||||
}
|
||||
case PageShare.ConfigType.Xray: {
|
||||
ExportController.generateXrayConfig(clientNameTextField.textField.text)
|
||||
configCaption = qsTr("Save XRay config")
|
||||
configExtension = ".json"
|
||||
configFileName = "amnezia_for_xray"
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
PageController.showBusyIndicator(false)
|
||||
|
||||
PageController.goToPage(PageEnum.PageShareConnection)
|
||||
var headerText = qsTr("Connection to ") + serverSelector.text
|
||||
var configContentHeaderText = qsTr("File with connection settings to ") + serverSelector.text
|
||||
PageController.goToShareConnectionPage(headerText, configContentHeaderText, configCaption, configExtension, configFileName)
|
||||
}
|
||||
|
||||
function onExportErrorOccurred(error) {
|
||||
|
||||
@@ -21,12 +21,6 @@ PageType {
|
||||
id: pageShareConnection
|
||||
|
||||
property string headerText
|
||||
|
||||
Component.onCompleted: {
|
||||
var serverName = ServersModel.getProcessedServerData("name") || ServersModel.getProcessedServerData("hostName") || "Server"
|
||||
headerText = qsTr("Connection to ") + serverName
|
||||
configContentHeaderText = qsTr("File with connection settings to ") + serverName
|
||||
}
|
||||
property string configContentHeaderText
|
||||
property string shareButtonText: qsTr("Share")
|
||||
property string copyButtonText: qsTr("Copy")
|
||||
@@ -36,17 +30,17 @@ PageType {
|
||||
property string configCaption: qsTr("Save AmneziaVPN config")
|
||||
property string configFileName: "amnezia_config"
|
||||
|
||||
onVisibleChanged: {
|
||||
configExtension = ".vpn"
|
||||
configCaption = qsTr("Save AmneziaVPN config")
|
||||
configFileName = "amnezia_config"
|
||||
// onVisibleChanged: {
|
||||
// configExtension = ".vpn"
|
||||
// configCaption = qsTr("Save AmneziaVPN config")
|
||||
// configFileName = "amnezia_config"
|
||||
|
||||
if (visible) {
|
||||
var serverName = ServersModel.getProcessedServerData("name") || ServersModel.getProcessedServerData("hostName") || "Server"
|
||||
headerText = qsTr("Connection to ") + serverName
|
||||
configContentHeaderText = qsTr("File with connection settings to ") + serverName
|
||||
}
|
||||
}
|
||||
// if (visible) {
|
||||
// var serverName = ServersModel.getProcessedServerData("name") || ServersModel.getProcessedServerData("hostName") || "Server"
|
||||
// headerText = qsTr("Connection to ") + serverName
|
||||
// configContentHeaderText = qsTr("File with connection settings to ") + serverName
|
||||
// }
|
||||
// }
|
||||
|
||||
BackButtonType {
|
||||
id: backButton
|
||||
|
||||
@@ -37,6 +37,9 @@ PageType {
|
||||
ListViewType {
|
||||
id: listView
|
||||
|
||||
property string headerText: ""
|
||||
property string configContentHeaderText: ""
|
||||
|
||||
anchors.top: backButton.bottom
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
@@ -108,8 +111,8 @@ PageType {
|
||||
serverSelector.currentIndex = serverSelectorListView.currentIndex
|
||||
}
|
||||
|
||||
shareConnectionPage.headerText = qsTr("Accessing ") + serverSelector.text
|
||||
shareConnectionPage.configContentHeaderText = qsTr("File with accessing settings to ") + serverSelector.text
|
||||
listView.headerText = qsTr("Accessing ") + serverSelector.text
|
||||
listView.configContentHeaderText = qsTr("File with accessing settings to ") + serverSelector.text
|
||||
serverSelector.closeTriggered()
|
||||
}
|
||||
|
||||
@@ -156,7 +159,7 @@ PageType {
|
||||
|
||||
PageController.showBusyIndicator(false)
|
||||
|
||||
PageController.goToPage(PageEnum.PageShareConnection)
|
||||
PageController.goToShareConnectionPage(listView.headerText, listView.configContentHeaderText, "", "", "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,19 @@ PageType {
|
||||
tabBarStackView.push(pagePath, { "objectName" : pagePath }, StackView.PushTransition)
|
||||
}
|
||||
|
||||
function onGoToShareConnectionPage(headerText, configContentHeaderText, configCaption, configExtension, configFileName) {
|
||||
var pagePath = PageController.getPagePath(PageEnum.PageShareConnection)
|
||||
tabBarStackView.push(pagePath,
|
||||
{ "objectName" : pagePath,
|
||||
"headerText" : headerText,
|
||||
"configContentHeaderText" : configContentHeaderText,
|
||||
"configCaption" : configCaption,
|
||||
"configExtension" : configExtension,
|
||||
"configFileName" : configFileName
|
||||
},
|
||||
StackView.PushTransition)
|
||||
}
|
||||
|
||||
function onDisableControls(disabled) {
|
||||
isControlsDisabled = disabled
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user