added display of amnesia dns container activity on the main page
This commit is contained in:
parent
2ef53c6df9
commit
795405c47d
21 changed files with 238 additions and 85 deletions
|
|
@ -270,5 +270,6 @@
|
||||||
<file>images/controls/telegram.svg</file>
|
<file>images/controls/telegram.svg</file>
|
||||||
<file>ui/qml/Controls2/TextTypes/SmallTextType.qml</file>
|
<file>ui/qml/Controls2/TextTypes/SmallTextType.qml</file>
|
||||||
<file>ui/qml/Filters/ContainersModelFilters.qml</file>
|
<file>ui/qml/Filters/ContainersModelFilters.qml</file>
|
||||||
|
<file>ui/qml/Components/ShowDetailsDrawer.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
||||||
|
|
@ -83,11 +83,13 @@ void ConnectionController::onConnectionStateChanged(Vpn::ConnectionState state)
|
||||||
}
|
}
|
||||||
case Vpn::ConnectionState::Error: {
|
case Vpn::ConnectionState::Error: {
|
||||||
m_isConnectionInProgress = false;
|
m_isConnectionInProgress = false;
|
||||||
|
m_connectionStateText = tr("Connect");
|
||||||
emit connectionErrorOccurred(getLastConnectionError());
|
emit connectionErrorOccurred(getLastConnectionError());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Vpn::ConnectionState::Unknown: {
|
case Vpn::ConnectionState::Unknown: {
|
||||||
m_isConnectionInProgress = false;
|
m_isConnectionInProgress = false;
|
||||||
|
m_connectionStateText = tr("Connect");
|
||||||
emit connectionErrorOccurred(getLastConnectionError());
|
emit connectionErrorOccurred(getLastConnectionError());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,15 +8,10 @@
|
||||||
|
|
||||||
SettingsController::SettingsController(const QSharedPointer<ServersModel> &serversModel,
|
SettingsController::SettingsController(const QSharedPointer<ServersModel> &serversModel,
|
||||||
const QSharedPointer<ContainersModel> &containersModel,
|
const QSharedPointer<ContainersModel> &containersModel,
|
||||||
const std::shared_ptr<Settings> &settings,
|
const std::shared_ptr<Settings> &settings, QObject *parent)
|
||||||
QObject *parent)
|
: QObject(parent), m_serversModel(serversModel), m_containersModel(containersModel), m_settings(settings)
|
||||||
: QObject(parent)
|
|
||||||
, m_serversModel(serversModel)
|
|
||||||
, m_containersModel(containersModel)
|
|
||||||
, m_settings(settings)
|
|
||||||
{
|
{
|
||||||
m_appVersion = QString("%1: %2 (%3)")
|
m_appVersion = QString("%1: %2 (%3)").arg(tr("Software version"), QString(APP_MAJOR_VERSION), __DATE__);
|
||||||
.arg(tr("Software version"), QString(APP_MAJOR_VERSION), __DATE__);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsController::setAmneziaDns(bool enable)
|
void SettingsController::setAmneziaDns(bool enable)
|
||||||
|
|
@ -79,21 +74,16 @@ void SettingsController::clearLogs()
|
||||||
|
|
||||||
void SettingsController::backupAppConfig()
|
void SettingsController::backupAppConfig()
|
||||||
{
|
{
|
||||||
Utils::saveFile(".backup",
|
Utils::saveFile(".backup", tr("Backup application config"), "AmneziaVPN", m_settings->backupAppConfig());
|
||||||
tr("Backup application config"),
|
|
||||||
"AmneziaVPN",
|
|
||||||
m_settings->backupAppConfig());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsController::restoreAppConfig()
|
void SettingsController::restoreAppConfig()
|
||||||
{
|
{
|
||||||
QString fileName = Utils::getFileName(Q_NULLPTR,
|
QString fileName =
|
||||||
tr("Open backup"),
|
Utils::getFileName(Q_NULLPTR, tr("Open backup"),
|
||||||
QStandardPaths::writableLocation(
|
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), "*.backup");
|
||||||
QStandardPaths::DocumentsLocation),
|
|
||||||
"*.backup");
|
|
||||||
|
|
||||||
//todo error processing
|
// todo error processing
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,10 @@ class SettingsController : public QObject
|
||||||
public:
|
public:
|
||||||
explicit SettingsController(const QSharedPointer<ServersModel> &serversModel,
|
explicit SettingsController(const QSharedPointer<ServersModel> &serversModel,
|
||||||
const QSharedPointer<ContainersModel> &containersModel,
|
const QSharedPointer<ContainersModel> &containersModel,
|
||||||
const std::shared_ptr<Settings> &settings,
|
const std::shared_ptr<Settings> &settings, QObject *parent = nullptr);
|
||||||
QObject *parent = nullptr);
|
|
||||||
|
|
||||||
Q_PROPERTY(QString primaryDns READ getPrimaryDns WRITE setPrimaryDns NOTIFY primaryDnsChanged)
|
Q_PROPERTY(QString primaryDns READ getPrimaryDns WRITE setPrimaryDns NOTIFY primaryDnsChanged)
|
||||||
Q_PROPERTY(
|
Q_PROPERTY(QString secondaryDns READ getSecondaryDns WRITE setSecondaryDns NOTIFY secondaryDnsChanged)
|
||||||
QString secondaryDns READ getSecondaryDns WRITE setSecondaryDns NOTIFY secondaryDnsChanged)
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setAmneziaDns(bool enable);
|
void setAmneziaDns(bool enable);
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,17 @@ void ContainersModel::clearCachedProfiles()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ContainersModel::isAmneziaDnsContainerInstalled()
|
||||||
|
{
|
||||||
|
return m_containers.contains(DockerContainer::Dns);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ContainersModel::isAmneziaDnsContainerInstalled(const int serverIndex)
|
||||||
|
{
|
||||||
|
QMap<DockerContainer, QJsonObject> containers = m_settings->containers(serverIndex);
|
||||||
|
return containers.contains(DockerContainer::Dns);
|
||||||
|
}
|
||||||
|
|
||||||
QHash<int, QByteArray> ContainersModel::roleNames() const
|
QHash<int, QByteArray> ContainersModel::roleNames() const
|
||||||
{
|
{
|
||||||
QHash<int, QByteArray> roles;
|
QHash<int, QByteArray> roles;
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,9 @@ public slots:
|
||||||
void removeAllContainers();
|
void removeAllContainers();
|
||||||
void clearCachedProfiles();
|
void clearCachedProfiles();
|
||||||
|
|
||||||
|
bool isAmneziaDnsContainerInstalled();
|
||||||
|
bool isAmneziaDnsContainerInstalled(const int serverIndex);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QHash<int, QByteArray> roleNames() const override;
|
QHash<int, QByteArray> roleNames() const override;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,10 +59,14 @@ QVariant ServersModel::data(const QModelIndex &index, int role) const
|
||||||
case CredentialsLoginRole: return m_settings->serverCredentials(index.row()).userName;
|
case CredentialsLoginRole: return m_settings->serverCredentials(index.row()).userName;
|
||||||
case IsDefaultRole: return index.row() == m_defaultServerIndex;
|
case IsDefaultRole: return index.row() == m_defaultServerIndex;
|
||||||
case IsCurrentlyProcessedRole: return index.row() == m_currenlyProcessedServerIndex;
|
case IsCurrentlyProcessedRole: return index.row() == m_currenlyProcessedServerIndex;
|
||||||
case HasWriteAccess: {
|
case HasWriteAccessRole: {
|
||||||
auto credentials = m_settings->serverCredentials(index.row());
|
auto credentials = m_settings->serverCredentials(index.row());
|
||||||
return (!credentials.userName.isEmpty() && !credentials.secretData.isEmpty());
|
return (!credentials.userName.isEmpty() && !credentials.secretData.isEmpty());
|
||||||
}
|
}
|
||||||
|
case ContainsAmneziaDnsRole: {
|
||||||
|
QString primaryDns = server.value(config_key::dns1).toString();
|
||||||
|
return primaryDns == protocols::dns::amneziaDnsIp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
@ -109,7 +113,12 @@ bool ServersModel::isDefaultServerCurrentlyProcessed()
|
||||||
|
|
||||||
bool ServersModel::isCurrentlyProcessedServerHasWriteAccess()
|
bool ServersModel::isCurrentlyProcessedServerHasWriteAccess()
|
||||||
{
|
{
|
||||||
return qvariant_cast<bool>(data(m_currenlyProcessedServerIndex, HasWriteAccess));
|
return qvariant_cast<bool>(data(m_currenlyProcessedServerIndex, HasWriteAccessRole));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ServersModel::isDefaultServerHasWriteAccess()
|
||||||
|
{
|
||||||
|
return qvariant_cast<bool>(data(m_currenlyProcessedServerIndex, HasWriteAccessRole));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServersModel::addServer(const QJsonObject &server)
|
void ServersModel::addServer(const QJsonObject &server)
|
||||||
|
|
@ -138,6 +147,13 @@ void ServersModel::removeServer()
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ServersModel::isDefaultServerConfigContainsAmneziaDns()
|
||||||
|
{
|
||||||
|
const QJsonObject server = m_servers.at(m_defaultServerIndex).toObject();
|
||||||
|
QString primaryDns = server.value(config_key::dns1).toString();
|
||||||
|
return primaryDns == protocols::dns::amneziaDnsIp;
|
||||||
|
}
|
||||||
|
|
||||||
QHash<int, QByteArray> ServersModel::roleNames() const
|
QHash<int, QByteArray> ServersModel::roleNames() const
|
||||||
{
|
{
|
||||||
QHash<int, QByteArray> roles;
|
QHash<int, QByteArray> roles;
|
||||||
|
|
@ -147,6 +163,7 @@ QHash<int, QByteArray> ServersModel::roleNames() const
|
||||||
roles[CredentialsLoginRole] = "credentialsLogin";
|
roles[CredentialsLoginRole] = "credentialsLogin";
|
||||||
roles[IsDefaultRole] = "isDefault";
|
roles[IsDefaultRole] = "isDefault";
|
||||||
roles[IsCurrentlyProcessedRole] = "isCurrentlyProcessed";
|
roles[IsCurrentlyProcessedRole] = "isCurrentlyProcessed";
|
||||||
roles[HasWriteAccess] = "hasWriteAccess";
|
roles[HasWriteAccessRole] = "hasWriteAccess";
|
||||||
|
roles[ContainsAmneziaDnsRole] = "containsAmneziaDns";
|
||||||
return roles;
|
return roles;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,8 @@ public:
|
||||||
CredentialsLoginRole,
|
CredentialsLoginRole,
|
||||||
IsDefaultRole,
|
IsDefaultRole,
|
||||||
IsCurrentlyProcessedRole,
|
IsCurrentlyProcessedRole,
|
||||||
HasWriteAccess
|
HasWriteAccessRole,
|
||||||
|
ContainsAmneziaDnsRole
|
||||||
};
|
};
|
||||||
|
|
||||||
ServersModel(std::shared_ptr<Settings> settings, QObject *parent = nullptr);
|
ServersModel(std::shared_ptr<Settings> settings, QObject *parent = nullptr);
|
||||||
|
|
@ -37,6 +38,7 @@ public slots:
|
||||||
bool isDefaultServerCurrentlyProcessed();
|
bool isDefaultServerCurrentlyProcessed();
|
||||||
|
|
||||||
bool isCurrentlyProcessedServerHasWriteAccess();
|
bool isCurrentlyProcessedServerHasWriteAccess();
|
||||||
|
bool isDefaultServerHasWriteAccess();
|
||||||
|
|
||||||
const int getServersCount();
|
const int getServersCount();
|
||||||
|
|
||||||
|
|
@ -46,6 +48,8 @@ public slots:
|
||||||
void addServer(const QJsonObject &server);
|
void addServer(const QJsonObject &server);
|
||||||
void removeServer();
|
void removeServer();
|
||||||
|
|
||||||
|
bool isDefaultServerConfigContainsAmneziaDns();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QHash<int, QByteArray> roleNames() const override;
|
QHash<int, QByteArray> roleNames() const override;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@ Button {
|
||||||
|
|
||||||
text: ConnectionController.connectionStateText
|
text: ConnectionController.connectionStateText
|
||||||
|
|
||||||
|
enabled: !ConnectionController.isConnectionInProgress
|
||||||
|
|
||||||
background: Item {
|
background: Item {
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,6 @@ DrawerType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BasicButtonType {
|
BasicButtonType {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 8
|
Layout.topMargin: 8
|
||||||
|
|
|
||||||
10
client/ui/qml/Components/ShowDetailsDrawer.qml
Normal file
10
client/ui/qml/Components/ShowDetailsDrawer.qml
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
|
||||||
|
import "../Controls2"
|
||||||
|
import "../Controls2/TextTypes"
|
||||||
|
|
||||||
|
Item {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -8,11 +8,9 @@ import "../Controls2/TextTypes"
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property var rootWidth: root.width
|
property real rootWidth: root.width
|
||||||
property int currentIndex
|
property int currentIndex
|
||||||
|
|
||||||
property alias mouseArea: transportProtoButtonMouseArea
|
|
||||||
|
|
||||||
implicitWidth: transportProtoButtonGroup.implicitWidth
|
implicitWidth: transportProtoButtonGroup.implicitWidth
|
||||||
implicitHeight: transportProtoButtonGroup.implicitHeight
|
implicitHeight: transportProtoButtonGroup.implicitHeight
|
||||||
|
|
||||||
|
|
@ -30,8 +28,6 @@ Rectangle {
|
||||||
implicitWidth: (rootWidth - 32) / 2
|
implicitWidth: (rootWidth - 32) / 2
|
||||||
text: "UDP"
|
text: "UDP"
|
||||||
|
|
||||||
hoverEnabled: !transportProtoButtonMouseArea.enabled
|
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.currentIndex = 0
|
root.currentIndex = 0
|
||||||
}
|
}
|
||||||
|
|
@ -43,17 +39,9 @@ Rectangle {
|
||||||
implicitWidth: (rootWidth - 32) / 2
|
implicitWidth: (rootWidth - 32) / 2
|
||||||
text: "TCP"
|
text: "TCP"
|
||||||
|
|
||||||
hoverEnabled: !transportProtoButtonMouseArea.enabled
|
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.currentIndex = 1
|
root.currentIndex = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: transportProtoButtonMouseArea
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ Item {
|
||||||
property string rootButtonImage: "qrc:/images/controls/chevron-down.svg"
|
property string rootButtonImage: "qrc:/images/controls/chevron-down.svg"
|
||||||
property string rootButtonImageColor: "#D7D8DB"
|
property string rootButtonImageColor: "#D7D8DB"
|
||||||
property string rootButtonBackgroundColor: "#1C1D21"
|
property string rootButtonBackgroundColor: "#1C1D21"
|
||||||
property int rootButtonMaximumWidth: 0
|
|
||||||
|
|
||||||
property string rootButtonHoveredBorderColor: "#494B50"
|
property string rootButtonHoveredBorderColor: "#494B50"
|
||||||
property string rootButtonDefaultBorderColor: "transparent"
|
property string rootButtonDefaultBorderColor: "transparent"
|
||||||
|
|
@ -88,8 +87,6 @@ Item {
|
||||||
horizontalAlignment: Text.AlignLeft
|
horizontalAlignment: Text.AlignLeft
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
|
||||||
Layout.maximumWidth: rootButtonMaximumWidth ? rootButtonMaximumWidth : implicitWidth
|
|
||||||
|
|
||||||
color: root.textColor
|
color: root.textColor
|
||||||
text: root.text
|
text: root.text
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,4 +88,10 @@ RadioButton {
|
||||||
horizontalAlignment: Qt.AlignHCenter
|
horizontalAlignment: Qt.AlignHCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
enabled: false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,13 +95,20 @@ PageType {
|
||||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||||
|
|
||||||
text: {
|
text: {
|
||||||
var string = ""
|
var description = ""
|
||||||
if (SettingsController.isAmneziaDnsEnabled()) {
|
if (ServersModel.isDefaultServerHasWriteAccess()) {
|
||||||
string += "Amnezia DNS | "
|
if (SettingsController.isAmneziaDnsEnabled()
|
||||||
|
&& ContainersModel.isAmneziaDnsContainerInstalled(ServersModel.getDefaultServerIndex())) {
|
||||||
|
description += "Amnezia DNS | "
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (ServersModel.isDefaultServerConfigContainsAmneziaDns) {
|
||||||
|
description += "Amnezia DNS | "
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string += root.currentContainerName + " | " + root.currentServerHostName
|
description += root.currentContainerName + " | " + root.currentServerHostName
|
||||||
return string
|
return description
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -153,7 +160,6 @@ PageType {
|
||||||
|
|
||||||
rootButtonBorderWidth: 0
|
rootButtonBorderWidth: 0
|
||||||
rootButtonImageColor: "#0E0E11"
|
rootButtonImageColor: "#0E0E11"
|
||||||
rootButtonMaximumWidth: 150 //todo make it dynamic
|
|
||||||
rootButtonBackgroundColor: "#D7D8DB"
|
rootButtonBackgroundColor: "#D7D8DB"
|
||||||
|
|
||||||
text: root.currentContainerName
|
text: root.currentContainerName
|
||||||
|
|
@ -194,14 +200,6 @@ PageType {
|
||||||
currentIndex: ContainersModel.getDefaultContainer()
|
currentIndex: ContainersModel.getDefaultContainer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BasicButtonType {
|
|
||||||
id: dnsButton
|
|
||||||
|
|
||||||
implicitHeight: 40
|
|
||||||
|
|
||||||
text: "Amnezia DNS"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Header2Type {
|
Header2Type {
|
||||||
|
|
@ -277,7 +275,21 @@ PageType {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
text: name
|
text: name
|
||||||
descriptionText: hostName
|
descriptionText: {
|
||||||
|
var description = ""
|
||||||
|
if (hasWriteAccess) {
|
||||||
|
if (SettingsController.isAmneziaDnsEnabled()
|
||||||
|
&& ContainersModel.isAmneziaDnsContainerInstalled(index)) {
|
||||||
|
description += "AmneziaDNS | "
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (containsAmneziaDns) {
|
||||||
|
description += "AmneziaDNS | "
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return description += hostName
|
||||||
|
}
|
||||||
|
|
||||||
checked: index === serversMenuContent.currentIndex
|
checked: index === serversMenuContent.currentIndex
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,12 @@ PageType {
|
||||||
property var installedProtocolsCount
|
property var installedProtocolsCount
|
||||||
|
|
||||||
SettingsContainersListView {
|
SettingsContainersListView {
|
||||||
|
id: settingsContainersListView
|
||||||
Connections {
|
Connections {
|
||||||
target: ServersModel
|
target: ServersModel
|
||||||
|
|
||||||
function onCurrentlyProcessedServerIndexChanged() {
|
function onCurrentlyProcessedServerIndexChanged() {
|
||||||
updateContainersModelFilters()
|
settingsContainersListView.updateContainersModelFilters()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,12 @@ PageType {
|
||||||
property var installedServicesCount
|
property var installedServicesCount
|
||||||
|
|
||||||
SettingsContainersListView {
|
SettingsContainersListView {
|
||||||
|
id: settingsContainersListView
|
||||||
Connections {
|
Connections {
|
||||||
target: ServersModel
|
target: ServersModel
|
||||||
|
|
||||||
function onCurrentlyProcessedServerIndexChanged() {
|
function onCurrentlyProcessedServerIndexChanged() {
|
||||||
updateContainersModelFilters()
|
settingsContainersListView.updateContainersModelFilters()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -121,18 +121,18 @@ PageType {
|
||||||
var hasEmptyField = false
|
var hasEmptyField = false
|
||||||
|
|
||||||
if (hostname.textFieldText === "") {
|
if (hostname.textFieldText === "") {
|
||||||
hostname.errorText = qsTr("ip address cannot be empty")
|
hostname.errorText = qsTr("Ip address cannot be empty")
|
||||||
hasEmptyField = true
|
hasEmptyField = true
|
||||||
} else if (!hostname.textField.acceptableInput) {
|
} else if (!hostname.textField.acceptableInput) {
|
||||||
hostname.errorText = qsTr("Enter the address in the format 255.255.255.255:88")
|
hostname.errorText = qsTr("Enter the address in the format 255.255.255.255:88")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (username.textFieldText === "") {
|
if (username.textFieldText === "") {
|
||||||
username.errorText = qsTr("login cannot be empty")
|
username.errorText = qsTr("Login cannot be empty")
|
||||||
hasEmptyField = true
|
hasEmptyField = true
|
||||||
}
|
}
|
||||||
if (secretData.textFieldText === "") {
|
if (secretData.textFieldText === "") {
|
||||||
secretData.errorText = qsTr("password/private key cannot be empty")
|
secretData.errorText = qsTr("Password/private key cannot be empty")
|
||||||
hasEmptyField = true
|
hasEmptyField = true
|
||||||
}
|
}
|
||||||
return !hasEmptyField
|
return !hasEmptyField
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ PageType {
|
||||||
}
|
}
|
||||||
|
|
||||||
FlickableType {
|
FlickableType {
|
||||||
id: fl
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
contentHeight: content.height
|
contentHeight: content.height
|
||||||
|
|
||||||
|
|
@ -41,18 +40,17 @@ PageType {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
// todo change id naming
|
id: processedContainerListView
|
||||||
id: containers
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: containers.contentItem.height
|
height: contentItem.height
|
||||||
currentIndex: -1
|
currentIndex: -1
|
||||||
clip: true
|
clip: true
|
||||||
interactive: false
|
interactive: false
|
||||||
model: proxyContainersModel
|
model: proxyContainersModel
|
||||||
|
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
implicitWidth: containers.width
|
implicitWidth: processedContainerListView.width
|
||||||
implicitHeight: delegateContent.implicitHeight
|
implicitHeight: (delegateContent.implicitHeight > root.height) ? delegateContent.implicitHeight : root.height
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: delegateContent
|
id: delegateContent
|
||||||
|
|
@ -72,8 +70,122 @@ PageType {
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
headerText: "Установка " + name
|
headerText: qsTr("Installing ") + name
|
||||||
descriptionText: "Эти настройки можно будет изменить позже"
|
descriptionText: qsTr("protocol description")
|
||||||
|
}
|
||||||
|
|
||||||
|
BasicButtonType {
|
||||||
|
id: showDetailsButton
|
||||||
|
|
||||||
|
Layout.topMargin: 16
|
||||||
|
Layout.leftMargin: -8
|
||||||
|
|
||||||
|
implicitHeight: 32
|
||||||
|
|
||||||
|
defaultColor: "transparent"
|
||||||
|
hoveredColor: Qt.rgba(1, 1, 1, 0.08)
|
||||||
|
pressedColor: Qt.rgba(1, 1, 1, 0.12)
|
||||||
|
disabledColor: "#878B91"
|
||||||
|
textColor: "#FBB26A"
|
||||||
|
|
||||||
|
text: qsTr("More detailed")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
showDetailsDrawer.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawerType {
|
||||||
|
id: showDetailsDrawer
|
||||||
|
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height * 0.9
|
||||||
|
|
||||||
|
BackButtonType {
|
||||||
|
id: showDetailsBackButton
|
||||||
|
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 16
|
||||||
|
anchors.leftMargin: 16
|
||||||
|
anchors.topMargin: 16
|
||||||
|
|
||||||
|
backButtonFunction: function() {
|
||||||
|
showDetailsDrawer.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FlickableType {
|
||||||
|
anchors.top: showDetailsBackButton.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
contentHeight: {
|
||||||
|
var emptySpaceHeight = parent.height - showDetailsBackButton.implicitHeight - showDetailsBackButton.anchors.topMargin
|
||||||
|
|
||||||
|
return (showDetailsDrawerContent.implicitHeight > emptySpaceHeight) ?
|
||||||
|
showDetailsDrawerContent.implicitHeight : emptySpaceHeight
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: showDetailsDrawerContent
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.rightMargin: 16
|
||||||
|
anchors.leftMargin: 16
|
||||||
|
|
||||||
|
Header2Type {
|
||||||
|
id: showDetailsDrawerHeader
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 16
|
||||||
|
|
||||||
|
headerText: name
|
||||||
|
}
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: 16
|
||||||
|
Layout.bottomMargin: 16
|
||||||
|
|
||||||
|
padding: 0
|
||||||
|
leftPadding: 0
|
||||||
|
height: 24
|
||||||
|
|
||||||
|
color: "#D7D8DB"
|
||||||
|
|
||||||
|
font.pixelSize: 16
|
||||||
|
font.weight: Font.Medium
|
||||||
|
font.family: "PT Root UI VF"
|
||||||
|
|
||||||
|
text: qsTr("detailed protocol description")
|
||||||
|
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
|
||||||
|
readOnly: true
|
||||||
|
background: Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: "transparent"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillHeight: true
|
||||||
|
color: "transparent"
|
||||||
|
}
|
||||||
|
|
||||||
|
BasicButtonType {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.bottomMargin: 32
|
||||||
|
|
||||||
|
text: qsTr("Close")
|
||||||
|
|
||||||
|
onClicked: function() {
|
||||||
|
showDetailsDrawer.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ParagraphTextType {
|
ParagraphTextType {
|
||||||
|
|
@ -96,15 +208,12 @@ PageType {
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 16
|
Layout.topMargin: 16
|
||||||
|
|
||||||
headerText: "Port"
|
headerText: "Port"
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
// todo make it dynamic
|
Layout.fillHeight: true
|
||||||
implicitHeight: root.height - port.implicitHeight -
|
|
||||||
transportProtoSelector.implicitHeight - transportProtoHeader.implicitHeight -
|
|
||||||
header.implicitHeight - backButton.implicitHeight - installButton.implicitHeight - 116
|
|
||||||
|
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -134,7 +243,9 @@ PageType {
|
||||||
transportProtoSelector.currentIndex = ProtocolProps.defaultTransportProto(defaultContainerProto)
|
transportProtoSelector.currentIndex = ProtocolProps.defaultTransportProto(defaultContainerProto)
|
||||||
|
|
||||||
port.enabled = ProtocolProps.defaultPortChangeable(defaultContainerProto)
|
port.enabled = ProtocolProps.defaultPortChangeable(defaultContainerProto)
|
||||||
transportProtoSelector.mouseArea.enabled = !ProtocolProps.defaultTransportProtoChangeable(defaultContainerProto)
|
var protocolSelectorVisible = ProtocolProps.defaultTransportProtoChangeable(defaultContainerProto)
|
||||||
|
transportProtoSelector.visible = protocolSelectorVisible
|
||||||
|
transportProtoHeader.visible = protocolSelectorVisible
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -260,12 +260,12 @@ PageType {
|
||||||
}
|
}
|
||||||
|
|
||||||
function fillConnectionTypeModel() {
|
function fillConnectionTypeModel() {
|
||||||
connectionTypesModel = [amneziaConnectionFormat]
|
root.connectionTypesModel = [amneziaConnectionFormat]
|
||||||
|
|
||||||
if (currentIndex === ContainerProps.containerFromString("OpenVpn")) {
|
if (currentIndex === ContainerProps.containerFromString("OpenVpn")) {
|
||||||
connectionTypesModel.push(openVpnConnectionFormat)
|
root.connectionTypesModel.push(openVpnConnectionFormat)
|
||||||
} else if (currentIndex === ContainerProps.containerFromString("wireGuardConnectionType")) {
|
} else if (currentIndex === ContainerProps.containerFromString("wireGuardConnectionType")) {
|
||||||
connectionTypesModel.push(amneziaConnectionFormat)
|
root.connectionTypesModel.push(amneziaConnectionFormat)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -287,7 +287,7 @@ PageType {
|
||||||
drawerHeight: 0.4375
|
drawerHeight: 0.4375
|
||||||
|
|
||||||
visible: accessTypeSelector.currentIndex === 0
|
visible: accessTypeSelector.currentIndex === 0
|
||||||
enabled: connectionTypesModel.length > 1
|
enabled: root.connectionTypesModel.length > 1
|
||||||
|
|
||||||
descriptionText: qsTr("Connection format")
|
descriptionText: qsTr("Connection format")
|
||||||
headerText: qsTr("Connection format")
|
headerText: qsTr("Connection format")
|
||||||
|
|
@ -298,7 +298,7 @@ PageType {
|
||||||
|
|
||||||
imageSource: "qrc:/images/controls/chevron-right.svg"
|
imageSource: "qrc:/images/controls/chevron-right.svg"
|
||||||
|
|
||||||
model: connectionTypesModel
|
model: root.connectionTypesModel
|
||||||
currentIndex: 0
|
currentIndex: 0
|
||||||
|
|
||||||
clickedFunction: function() {
|
clickedFunction: function() {
|
||||||
|
|
@ -326,7 +326,7 @@ PageType {
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (accessTypeSelector.currentIndex === 0) {
|
if (accessTypeSelector.currentIndex === 0) {
|
||||||
connectionTypesModel[connectionTypeSelector.currentIndex].func()
|
root.connectionTypesModel[accessTypeSelector.currentIndex].func()
|
||||||
} else {
|
} else {
|
||||||
ExportController.generateConfig(true)
|
ExportController.generateConfig(true)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,8 +77,8 @@ PageType {
|
||||||
isSelected: tabBar.currentIndex === 0
|
isSelected: tabBar.currentIndex === 0
|
||||||
image: "qrc:/images/controls/home.svg"
|
image: "qrc:/images/controls/home.svg"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
ServersModel.currentlyProcessedIndex = ServersModel.defaultIndex
|
|
||||||
tabBarStackView.goToTabBarPage(PageEnum.PageHome)
|
tabBarStackView.goToTabBarPage(PageEnum.PageHome)
|
||||||
|
ServersModel.currentlyProcessedIndex = ServersModel.defaultIndex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TabImageButtonType {
|
TabImageButtonType {
|
||||||
|
|
@ -94,7 +94,7 @@ PageType {
|
||||||
}
|
}
|
||||||
|
|
||||||
visible: ServersModel.isCurrentlyProcessedServerHasWriteAccess()
|
visible: ServersModel.isCurrentlyProcessedServerHasWriteAccess()
|
||||||
width: visible ? undefined : 0
|
width: ServersModel.isCurrentlyProcessedServerHasWriteAccess() ? undefined : 0
|
||||||
|
|
||||||
isSelected: tabBar.currentIndex === 1
|
isSelected: tabBar.currentIndex === 1
|
||||||
image: "qrc:/images/controls/share-2.svg"
|
image: "qrc:/images/controls/share-2.svg"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue