minor ui fixes
This commit is contained in:
parent
420c616e9d
commit
f7926847ac
11 changed files with 50 additions and 34 deletions
|
@ -249,3 +249,13 @@ QString ContainerProps::easySetupDescription(DockerContainer container)
|
||||||
default: return "";
|
default: return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ContainerProps::isShareable(DockerContainer container)
|
||||||
|
{
|
||||||
|
switch (container) {
|
||||||
|
case DockerContainer::TorWebSite: return false;
|
||||||
|
case DockerContainer::Dns: return false;
|
||||||
|
case DockerContainer::Sftp: return false;
|
||||||
|
default: return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -64,6 +64,8 @@ namespace amnezia
|
||||||
static bool isEasySetupContainer(amnezia::DockerContainer container);
|
static bool isEasySetupContainer(amnezia::DockerContainer container);
|
||||||
static QString easySetupHeader(amnezia::DockerContainer container);
|
static QString easySetupHeader(amnezia::DockerContainer container);
|
||||||
static QString easySetupDescription(amnezia::DockerContainer container);
|
static QString easySetupDescription(amnezia::DockerContainer container);
|
||||||
|
|
||||||
|
static bool isShareable(amnezia::DockerContainer container);
|
||||||
};
|
};
|
||||||
|
|
||||||
static void declareQmlContainerEnum()
|
static void declareQmlContainerEnum()
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "configurators/openvpn_configurator.h"
|
#include "configurators/openvpn_configurator.h"
|
||||||
#include "configurators/wireguard_configurator.h"
|
#include "configurators/wireguard_configurator.h"
|
||||||
#include "core/errorstrings.h"
|
#include "core/errorstrings.h"
|
||||||
|
#include "utilities.h"
|
||||||
#ifdef Q_OS_ANDROID
|
#ifdef Q_OS_ANDROID
|
||||||
#include "platforms/android/android_controller.h"
|
#include "platforms/android/android_controller.h"
|
||||||
#include "platforms/android/androidutils.h"
|
#include "platforms/android/androidutils.h"
|
||||||
|
@ -201,7 +202,7 @@ QList<QString> ExportController::getQrCodes()
|
||||||
return m_qrCodes;
|
return m_qrCodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExportController::saveFile()
|
void ExportController::saveFile(const QString &fileExtension, const QString &caption, const QString &fileName)
|
||||||
{
|
{
|
||||||
#if defined Q_OS_IOS
|
#if defined Q_OS_IOS
|
||||||
// ext.replace("*", "");
|
// ext.replace("*", "");
|
||||||
|
@ -229,27 +230,7 @@ void ExportController::saveFile()
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QString fileExtension = ".vpn";
|
Utils::saveFile(fileExtension, caption, fileName, m_config);
|
||||||
QString docDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
|
|
||||||
QUrl fileName;
|
|
||||||
fileName = QFileDialog::getSaveFileUrl(nullptr, tr("Save AmneziaVPN config"),
|
|
||||||
QUrl::fromLocalFile(docDir + "/" + "amnezia_config"), "*" + fileExtension);
|
|
||||||
if (fileName.isEmpty())
|
|
||||||
return;
|
|
||||||
if (!fileName.toString().endsWith(fileExtension)) {
|
|
||||||
fileName = QUrl(fileName.toString() + fileExtension);
|
|
||||||
}
|
|
||||||
if (fileName.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
QFile save(fileName.toLocalFile());
|
|
||||||
|
|
||||||
save.open(QIODevice::WriteOnly);
|
|
||||||
save.write(m_config.toUtf8());
|
|
||||||
save.close();
|
|
||||||
|
|
||||||
QFileInfo fi(fileName.toLocalFile());
|
|
||||||
QDesktopServices::openUrl(fi.absoluteDir().absolutePath());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QString> ExportController::generateQrCodeImageSeries(const QByteArray &data)
|
QList<QString> ExportController::generateQrCodeImageSeries(const QByteArray &data)
|
||||||
|
|
|
@ -35,7 +35,7 @@ public slots:
|
||||||
QString getConfig();
|
QString getConfig();
|
||||||
QList<QString> getQrCodes();
|
QList<QString> getQrCodes();
|
||||||
|
|
||||||
void saveFile();
|
void saveFile(const QString &fileExtension, const QString &caption, const QString &fileName);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void generateConfig(int type);
|
void generateConfig(int type);
|
||||||
|
|
|
@ -79,6 +79,7 @@ QVariant ContainersModel::data(const QModelIndex &index, int role) const
|
||||||
case IsCurrentlyProcessedRole: return container == static_cast<DockerContainer>(m_currentlyProcessedContainerIndex);
|
case IsCurrentlyProcessedRole: return container == static_cast<DockerContainer>(m_currentlyProcessedContainerIndex);
|
||||||
case IsDefaultRole: return container == m_defaultContainerIndex;
|
case IsDefaultRole: return container == m_defaultContainerIndex;
|
||||||
case IsSupportedRole: return ContainerProps::isSupportedByCurrentPlatform(container);
|
case IsSupportedRole: return ContainerProps::isSupportedByCurrentPlatform(container);
|
||||||
|
case IsShareableRole: return ContainerProps::isShareable(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
@ -235,5 +236,6 @@ QHash<int, QByteArray> ContainersModel::roleNames() const
|
||||||
roles[IsCurrentlyProcessedRole] = "isCurrentlyProcessed";
|
roles[IsCurrentlyProcessedRole] = "isCurrentlyProcessed";
|
||||||
roles[IsDefaultRole] = "isDefault";
|
roles[IsDefaultRole] = "isDefault";
|
||||||
roles[IsSupportedRole] = "isSupported";
|
roles[IsSupportedRole] = "isSupported";
|
||||||
|
roles[IsShareableRole] = "isShareable";
|
||||||
return roles;
|
return roles;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,8 @@ public:
|
||||||
IsInstalledRole,
|
IsInstalledRole,
|
||||||
IsCurrentlyProcessedRole,
|
IsCurrentlyProcessedRole,
|
||||||
IsDefaultRole,
|
IsDefaultRole,
|
||||||
IsSupportedRole
|
IsSupportedRole,
|
||||||
|
IsShareableRole
|
||||||
};
|
};
|
||||||
|
|
||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
|
|
|
@ -19,9 +19,19 @@ DrawerType {
|
||||||
property alias configContentHeaderText: configContentHeader.headerText
|
property alias configContentHeaderText: configContentHeader.headerText
|
||||||
property alias contentVisible: content.visible
|
property alias contentVisible: content.visible
|
||||||
|
|
||||||
|
property string configExtension: ".vpn"
|
||||||
|
property string configCaption: qsTr("Save AmneziaVPN config")
|
||||||
|
property string configFileName: "amnezia_config.vpn"
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height * 0.9
|
height: parent.height * 0.9
|
||||||
|
|
||||||
|
onClosed: {
|
||||||
|
configExtension = ".vpn"
|
||||||
|
configCaption = qsTr("Save AmneziaVPN config")
|
||||||
|
configFileName = "amnezia_config.vpn"
|
||||||
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
@ -58,7 +68,7 @@ DrawerType {
|
||||||
imageSource: "qrc:/images/controls/share-2.svg"
|
imageSource: "qrc:/images/controls/share-2.svg"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
ExportController.saveFile()
|
ExportController.saveFile(configExtension, configCaption, configFileName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ And if you don't like the app, all the more support it - the donation will be us
|
||||||
leftImageSource: "qrc:/images/controls/amnezia.svg"
|
leftImageSource: "qrc:/images/controls/amnezia.svg"
|
||||||
|
|
||||||
clickedFunction: function() {
|
clickedFunction: function() {
|
||||||
Qt.openUrlExternally(qsTr("amnezia.org/"))
|
Qt.openUrlExternally(qsTr("https://amnezia.org"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,6 @@ PageType {
|
||||||
Layout.rightMargin: 16
|
Layout.rightMargin: 16
|
||||||
|
|
||||||
text: qsTr("Use AmneziaDNS if installed on the server")
|
text: qsTr("Use AmneziaDNS if installed on the server")
|
||||||
descriptionText: qsTr("Internal IP address 172.29.172.254")
|
|
||||||
|
|
||||||
checked: SettingsController.isAmneziaDnsEnabled()
|
checked: SettingsController.isAmneziaDnsEnabled()
|
||||||
onCheckedChanged: {
|
onCheckedChanged: {
|
||||||
|
|
|
@ -73,10 +73,6 @@ PageType {
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
console.log(qrCodeRectange.x)
|
|
||||||
console.log(qrCodeRectange.y)
|
|
||||||
console.log(qrCodeRectange.width)
|
|
||||||
|
|
||||||
qrCodeReader.setCameraSize(Qt.rect(qrCodeRectange.x,
|
qrCodeReader.setCameraSize(Qt.rect(qrCodeRectange.x,
|
||||||
qrCodeRectange.y,
|
qrCodeRectange.y,
|
||||||
qrCodeRectange.width,
|
qrCodeRectange.width,
|
||||||
|
|
|
@ -41,8 +41,20 @@ PageType {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PageShare.ConfigType.OpenVpn: ExportController.generateOpenVpnConfig(); break;
|
case PageShare.ConfigType.OpenVpn: {
|
||||||
case PageShare.ConfigType.WireGuard: ExportController.generateWireGuardConfig(); break;
|
ExportController.generateOpenVpnConfig();
|
||||||
|
shareConnectionDrawer.configCaption = qsTr("Save OpenVPN config")
|
||||||
|
shareConnectionDrawer.configExtension = ".ovpn"
|
||||||
|
shareConnectionDrawer.configFileName = "amnezia_for_openvpn"
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PageShare.ConfigType.WireGuard: {
|
||||||
|
ExportController.generateWireGuardConfig();
|
||||||
|
shareConnectionDrawer.configCaption = qsTr("Save WireGuard config")
|
||||||
|
shareConnectionDrawer.configExtension = ".conf"
|
||||||
|
shareConnectionDrawer.configFileName = "amnezia_for_wireguard"
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PageController.showBusyIndicator(false)
|
PageController.showBusyIndicator(false)
|
||||||
|
@ -267,6 +279,10 @@ PageType {
|
||||||
ValueFilter {
|
ValueFilter {
|
||||||
roleName: "isInstalled"
|
roleName: "isInstalled"
|
||||||
value: true
|
value: true
|
||||||
|
},
|
||||||
|
ValueFilter {
|
||||||
|
roleName: "isShareable"
|
||||||
|
value: true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -339,7 +355,6 @@ PageType {
|
||||||
|
|
||||||
listView: ListViewWithRadioButtonType {
|
listView: ListViewWithRadioButtonType {
|
||||||
onCurrentIndexChanged: {
|
onCurrentIndexChanged: {
|
||||||
console.log(currentIndex)
|
|
||||||
exportTypeSelector.currentIndex = currentIndex
|
exportTypeSelector.currentIndex = currentIndex
|
||||||
exportTypeSelector.text = selectedText
|
exportTypeSelector.text = selectedText
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue