qml ui fixes
This commit is contained in:
parent
a390f2e988
commit
0d9f1ba95b
26 changed files with 168 additions and 103 deletions
|
@ -1,5 +1,3 @@
|
|||
!contains( CONFIG, c\+\+1[14] ): warning("SortFilterProxyModel needs at least c++11, add CONFIG += c++11 to your .pro")
|
||||
|
||||
INCLUDEPATH += $$PWD
|
||||
|
||||
HEADERS += $$PWD/qqmlsortfilterproxymodel.h \
|
||||
|
|
|
@ -116,8 +116,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
app.setQuitOnLastWindowClosed(false);
|
||||
|
||||
qRegisterMetaType<amnezia::DockerContainer>("amnezia::DockerContainer");
|
||||
qRegisterMetaType<amnezia::Protocol>("amnezia::Protocol");
|
||||
qRegisterMetaType<DockerContainer>("DockerContainer");
|
||||
qRegisterMetaType<Protocol>("Protocol");
|
||||
qRegisterMetaType<Page>("Page");
|
||||
|
||||
qRegisterMetaType<PageProtocolLogicBase *>("PageProtocolLogicBase *");
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ QHash<int, QByteArray> ContainersModel::roleNames() const {
|
|||
QHash<int, QByteArray> roles;
|
||||
roles[NameRole] = "name_role";
|
||||
roles[DescRole] = "desc_role";
|
||||
roles[DefaultRole] = "default_role";
|
||||
roles[isVpnTypeRole] = "is_vpn_role";
|
||||
roles[isOtherTypeRole] = "is_other_role";
|
||||
roles[isInstalledRole] = "is_installed_role";
|
||||
|
@ -36,6 +37,9 @@ QVariant ContainersModel::data(const QModelIndex &index, int role) const
|
|||
if (role == DescRole) {
|
||||
return containerDescriptions().value(c);
|
||||
}
|
||||
if (role == DefaultRole) {
|
||||
return c == m_settings.defaultContainer(m_selectedServerIndex);
|
||||
}
|
||||
if (role == isVpnTypeRole) {
|
||||
return isContainerVpnType(c);
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ public:
|
|||
enum SiteRoles {
|
||||
NameRole = Qt::UserRole + 1,
|
||||
DescRole,
|
||||
DefaultRole,
|
||||
isVpnTypeRole,
|
||||
isOtherTypeRole,
|
||||
isInstalledRole
|
||||
|
|
|
@ -55,7 +55,7 @@ void ProtocolsModel::setSelectedServerIndex(int index)
|
|||
endResetModel();
|
||||
}
|
||||
|
||||
void ProtocolsModel::setSelectedDockerContainer(amnezia::DockerContainer c)
|
||||
void ProtocolsModel::setSelectedDockerContainer(DockerContainer c)
|
||||
{
|
||||
beginResetModel();
|
||||
m_selectedDockerContainer = c;
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
Q_INVOKABLE void setSelectedServerIndex(int index);
|
||||
Q_INVOKABLE void setSelectedDockerContainer(amnezia::DockerContainer c);
|
||||
Q_INVOKABLE void setSelectedDockerContainer(DockerContainer c);
|
||||
|
||||
protected:
|
||||
QHash<int, QByteArray> roleNames() const override;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
namespace PageEnumNS
|
||||
{
|
||||
Q_NAMESPACE
|
||||
enum Page {Start = 0, NewServer, NewServerProtocols, Vpn,
|
||||
enum class Page {Start = 0, NewServer, NewServerProtocols, Vpn,
|
||||
Wizard, WizardLow, WizardMedium, WizardHigh, WizardVpnMode, ServerConfiguring,
|
||||
GeneralSettings, AppSettings, NetworkSettings, ServerSettings,
|
||||
ServerContainers, ServersList, ShareConnection, Sites,
|
||||
|
|
|
@ -13,10 +13,6 @@ ServerContainersLogic::ServerContainersLogic(UiLogic *logic, QObject *parent):
|
|||
PageLogicBase(logic, parent),
|
||||
m_progressBarProtocolsContainerReinstallValue{0},
|
||||
m_progressBarProtocolsContainerReinstallMaximium{100},
|
||||
m_pushButtonOpenVpnContInstallChecked{false},
|
||||
m_pushButtonSsOpenVpnContInstallChecked{false},
|
||||
m_pushButtonCloakOpenVpnContInstallChecked{false},
|
||||
m_pushButtonWireguardContInstallChecked{false},
|
||||
m_pushButtonOpenVpnContInstallEnabled{false},
|
||||
m_pushButtonSsOpenVpnContInstallEnabled{false},
|
||||
m_pushButtonCloakOpenVpnContInstallEnabled{false},
|
||||
|
@ -71,12 +67,7 @@ void ServerContainersLogic::updateServerContainersPage()
|
|||
using SetVisibleFunc = std::function<void(bool)>;
|
||||
using SetCheckedFunc = std::function<void(bool)>;
|
||||
using SetEnabledFunc = std::function<void(bool)>;
|
||||
QList<SetCheckedFunc> installButtonsCheckedFunc {
|
||||
[this](bool checked) ->void {set_pushButtonOpenVpnContInstallChecked(checked);},
|
||||
[this](bool checked) ->void {set_pushButtonSsOpenVpnContInstallChecked(checked);},
|
||||
[this](bool checked) ->void {set_pushButtonCloakOpenVpnContInstallChecked(checked);},
|
||||
[this](bool checked) ->void {set_pushButtonWireguardContInstallChecked(checked);},
|
||||
};
|
||||
|
||||
QList<SetEnabledFunc> installButtonsEnabledFunc {
|
||||
[this](bool enabled) ->void {set_pushButtonOpenVpnContInstallEnabled(enabled);},
|
||||
[this](bool enabled) ->void {set_pushButtonSsOpenVpnContInstallEnabled(enabled);},
|
||||
|
@ -115,22 +106,33 @@ void ServerContainersLogic::updateServerContainersPage()
|
|||
defaultButtonsCheckedFunc.at(i)(defaultContainer == allContainers.at(i));
|
||||
defaultButtonsVisibleFunc.at(i)(haveAuthData && containers.contains(allContainers.at(i)));
|
||||
shareButtonsVisibleFunc.at(i)(haveAuthData && containers.contains(allContainers.at(i)));
|
||||
installButtonsCheckedFunc.at(i)(containers.contains(allContainers.at(i)));
|
||||
installButtonsEnabledFunc.at(i)(haveAuthData);
|
||||
framesVisibleFunc.at(i)(containers.contains(allContainers.at(i)));
|
||||
}
|
||||
}
|
||||
|
||||
void ServerContainersLogic::onPushButtonProtoSettingsClicked(amnezia::DockerContainer c, amnezia::Protocol p)
|
||||
void ServerContainersLogic::onPushButtonProtoSettingsClicked(DockerContainer c, Protocol p)
|
||||
{
|
||||
qDebug()<< "ServerContainersLogic::onPushButtonProtoSettingsClicked" << c << p;
|
||||
uiLogic()->selectedDockerContainer = c;
|
||||
uiLogic()->protocolLogic(p)->updateProtocolPage(m_settings.protocolConfig(uiLogic()->selectedServerIndex, uiLogic()->selectedDockerContainer, p),
|
||||
uiLogic()->selectedDockerContainer,
|
||||
m_settings.haveAuthData(uiLogic()->selectedServerIndex));
|
||||
|
||||
emit uiLogic()->goToProtocolPage(static_cast<int>(p));
|
||||
emit uiLogic()->goToProtocolPage(p);
|
||||
}
|
||||
|
||||
void ServerContainersLogic::onPushButtonDefaultClicked(DockerContainer c)
|
||||
{
|
||||
m_settings.setDefaultContainer(uiLogic()->selectedServerIndex, c);
|
||||
updateServerContainersPage();
|
||||
}
|
||||
|
||||
void ServerContainersLogic::onPushButtonShareClicked(DockerContainer c)
|
||||
{
|
||||
uiLogic()->shareConnectionLogic()->updateSharingPage(uiLogic()->selectedServerIndex, m_settings.serverCredentials(uiLogic()->selectedServerIndex), c);
|
||||
emit uiLogic()->goToPage(Page::ShareConnection);
|
||||
}
|
||||
|
||||
void ServerContainersLogic::setupProtocolsPageConnections()
|
||||
{
|
||||
|
@ -146,21 +148,6 @@ void ServerContainersLogic::setupProtocolsPageConnections()
|
|||
using ButtonClickedFunc = void (ServerContainersLogic::*)(bool);
|
||||
using ButtonSetEnabledFunc = std::function<void(bool)>;
|
||||
|
||||
// default buttons
|
||||
QList<ButtonClickedFunc> defaultButtonClickedSig {
|
||||
&ServerContainersLogic::pushButtonOpenVpnContDefaultClicked,
|
||||
&ServerContainersLogic::pushButtonSsOpenVpnContDefaultClicked,
|
||||
&ServerContainersLogic::pushButtonCloakOpenVpnContDefaultClicked,
|
||||
&ServerContainersLogic::pushButtonWireguardContDefaultClicked
|
||||
};
|
||||
|
||||
for (int i = 0; i < containers.size(); ++i) {
|
||||
connect(this, defaultButtonClickedSig.at(i), [this, containers, i](bool){
|
||||
qDebug() << "clmm" << i;
|
||||
m_settings.setDefaultContainer(uiLogic()->selectedServerIndex, containers.at(i));
|
||||
updateServerContainersPage();
|
||||
});
|
||||
}
|
||||
|
||||
// install buttons
|
||||
QList<ButtonClickedFunc> installButtonsClickedSig {
|
||||
|
@ -253,7 +240,7 @@ void ServerContainersLogic::setupProtocolsPageConnections()
|
|||
|
||||
connect(this, buttonClickedFunc, [this, container](bool){
|
||||
uiLogic()->shareConnectionLogic()->updateSharingPage(uiLogic()->selectedServerIndex, m_settings.serverCredentials(uiLogic()->selectedServerIndex), container);
|
||||
uiLogic()->goToPage(Page::ShareConnection);
|
||||
emit uiLogic()->goToPage(Page::ShareConnection);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,26 +12,31 @@ class ServerContainersLogic : public PageLogicBase
|
|||
AUTO_PROPERTY(int, progressBarProtocolsContainerReinstallValue)
|
||||
AUTO_PROPERTY(int, progressBarProtocolsContainerReinstallMaximium)
|
||||
|
||||
AUTO_PROPERTY(bool, pushButtonOpenVpnContInstallChecked)
|
||||
AUTO_PROPERTY(bool, pushButtonSsOpenVpnContInstallChecked)
|
||||
AUTO_PROPERTY(bool, pushButtonCloakOpenVpnContInstallChecked)
|
||||
AUTO_PROPERTY(bool, pushButtonWireguardContInstallChecked)
|
||||
// AUTO_PROPERTY(bool, pushButtonOpenVpnContInstallChecked)
|
||||
// AUTO_PROPERTY(bool, pushButtonSsOpenVpnContInstallChecked)
|
||||
// AUTO_PROPERTY(bool, pushButtonCloakOpenVpnContInstallChecked)
|
||||
// AUTO_PROPERTY(bool, pushButtonWireguardContInstallChecked)
|
||||
|
||||
AUTO_PROPERTY(bool, pushButtonOpenVpnContInstallEnabled)
|
||||
AUTO_PROPERTY(bool, pushButtonSsOpenVpnContInstallEnabled)
|
||||
AUTO_PROPERTY(bool, pushButtonCloakOpenVpnContInstallEnabled)
|
||||
AUTO_PROPERTY(bool, pushButtonWireguardContInstallEnabled)
|
||||
|
||||
AUTO_PROPERTY(bool, pushButtonOpenVpnContDefaultChecked)
|
||||
AUTO_PROPERTY(bool, pushButtonSsOpenVpnContDefaultChecked)
|
||||
AUTO_PROPERTY(bool, pushButtonCloakOpenVpnContDefaultChecked)
|
||||
AUTO_PROPERTY(bool, pushButtonWireguardContDefaultChecked)
|
||||
|
||||
AUTO_PROPERTY(bool, pushButtonOpenVpnContDefaultVisible)
|
||||
AUTO_PROPERTY(bool, pushButtonSsOpenVpnContDefaultVisible)
|
||||
AUTO_PROPERTY(bool, pushButtonCloakOpenVpnContDefaultVisible)
|
||||
AUTO_PROPERTY(bool, pushButtonWireguardContDefaultVisible)
|
||||
|
||||
AUTO_PROPERTY(bool, pushButtonOpenVpnContShareVisible)
|
||||
AUTO_PROPERTY(bool, pushButtonSsOpenVpnContShareVisible)
|
||||
AUTO_PROPERTY(bool, pushButtonCloakOpenVpnContShareVisible)
|
||||
AUTO_PROPERTY(bool, pushButtonWireguardContShareVisible)
|
||||
|
||||
AUTO_PROPERTY(bool, frameOpenvpnSettingsVisible)
|
||||
AUTO_PROPERTY(bool, frameOpenvpnSsSettingsVisible)
|
||||
AUTO_PROPERTY(bool, frameOpenvpnSsCloakSettingsVisible)
|
||||
|
@ -42,7 +47,9 @@ class ServerContainersLogic : public PageLogicBase
|
|||
|
||||
public:
|
||||
Q_INVOKABLE void updateServerContainersPage();
|
||||
Q_INVOKABLE void onPushButtonProtoSettingsClicked(amnezia::DockerContainer c, amnezia::Protocol p);
|
||||
Q_INVOKABLE void onPushButtonProtoSettingsClicked(DockerContainer c, Protocol p);
|
||||
Q_INVOKABLE void onPushButtonDefaultClicked(DockerContainer c);
|
||||
Q_INVOKABLE void onPushButtonShareClicked(DockerContainer c);
|
||||
|
||||
public:
|
||||
explicit ServerContainersLogic(UiLogic *uiLogic, QObject *parent = nullptr);
|
||||
|
|
|
@ -156,7 +156,7 @@ void StartPageLogic::onPushButtonImport()
|
|||
m_settings.addServer(o);
|
||||
m_settings.setDefaultServer(m_settings.serversCount() - 1);
|
||||
|
||||
uiLogic()->setStartPage(Page::Vpn);
|
||||
emit uiLogic()->setStartPage(Page::Vpn);
|
||||
}
|
||||
else {
|
||||
qDebug() << "Failed to import profile";
|
||||
|
|
|
@ -11,7 +11,6 @@ CloakLogic::CloakLogic(UiLogic *logic, QObject *parent):
|
|||
m_comboBoxProtoCloakCipherText{"chacha20-poly1305"},
|
||||
m_lineEditProtoCloakSiteText{"tile.openstreetmap.org"},
|
||||
m_lineEditProtoCloakPortText{},
|
||||
m_widgetProtoCloakEnabled{false},
|
||||
m_pushButtonCloakSaveVisible{false},
|
||||
m_progressBarProtoCloakResetVisible{false},
|
||||
m_lineEditProtoCloakPortEnabled{false},
|
||||
|
@ -26,7 +25,7 @@ CloakLogic::CloakLogic(UiLogic *logic, QObject *parent):
|
|||
|
||||
void CloakLogic::updateProtocolPage(const QJsonObject &ckConfig, DockerContainer container, bool haveAuthData)
|
||||
{
|
||||
set_widgetProtoCloakEnabled(haveAuthData);
|
||||
set_pageEnabled(haveAuthData);
|
||||
set_pushButtonCloakSaveVisible(haveAuthData);
|
||||
set_progressBarProtoCloakResetVisible(haveAuthData);
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ class CloakLogic : public PageProtocolLogicBase
|
|||
AUTO_PROPERTY(QString, comboBoxProtoCloakCipherText)
|
||||
AUTO_PROPERTY(QString, lineEditProtoCloakSiteText)
|
||||
AUTO_PROPERTY(QString, lineEditProtoCloakPortText)
|
||||
AUTO_PROPERTY(bool, widgetProtoCloakEnabled)
|
||||
AUTO_PROPERTY(bool, pushButtonCloakSaveVisible)
|
||||
AUTO_PROPERTY(bool, progressBarProtoCloakResetVisible)
|
||||
AUTO_PROPERTY(bool, lineEditProtoCloakPortEnabled)
|
||||
|
|
|
@ -21,7 +21,6 @@ OpenVpnLogic::OpenVpnLogic(UiLogic *logic, QObject *parent):
|
|||
m_checkBoxProtoOpenVpnBlockDnsChecked{false},
|
||||
m_lineEditProtoOpenVpnPortText{},
|
||||
m_checkBoxProtoOpenVpnTlsAuthChecked{false},
|
||||
m_widgetProtoOpenVpnEnabled{true},
|
||||
m_pushButtonOpenvpnSaveVisible{false},
|
||||
m_progressBarProtoOpenVpnResetVisible{false},
|
||||
|
||||
|
@ -39,7 +38,7 @@ OpenVpnLogic::OpenVpnLogic(UiLogic *logic, QObject *parent):
|
|||
void OpenVpnLogic::updateProtocolPage(const QJsonObject &openvpnConfig, DockerContainer container, bool haveAuthData)
|
||||
{
|
||||
qDebug() << "OpenVpnLogic::updateProtocolPage";
|
||||
set_widgetProtoOpenVpnEnabled(haveAuthData);
|
||||
set_pageEnabled(haveAuthData);
|
||||
set_pushButtonOpenvpnSaveVisible(haveAuthData);
|
||||
set_progressBarProtoOpenVpnResetVisible(haveAuthData);
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ class OpenVpnLogic : public PageProtocolLogicBase
|
|||
AUTO_PROPERTY(QString, lineEditProtoOpenVpnPortText)
|
||||
AUTO_PROPERTY(bool, checkBoxProtoOpenVpnTlsAuthChecked)
|
||||
|
||||
AUTO_PROPERTY(bool, widgetProtoOpenVpnEnabled)
|
||||
AUTO_PROPERTY(bool, pushButtonOpenvpnSaveVisible)
|
||||
AUTO_PROPERTY(bool, progressBarProtoOpenVpnResetVisible)
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ using namespace PageEnumNS;
|
|||
|
||||
ShadowSocksLogic::ShadowSocksLogic(UiLogic *logic, QObject *parent):
|
||||
PageProtocolLogicBase(logic, parent),
|
||||
m_widgetProtoShadowSocksEnabled{false},
|
||||
m_comboBoxProtoShadowSocksCipherText{"chacha20-poly1305"},
|
||||
m_lineEditProtoShadowSocksPortText{},
|
||||
m_pushButtonShadowSocksSaveVisible{false},
|
||||
|
@ -25,7 +24,7 @@ ShadowSocksLogic::ShadowSocksLogic(UiLogic *logic, QObject *parent):
|
|||
|
||||
void ShadowSocksLogic::updateProtocolPage(const QJsonObject &ssConfig, DockerContainer container, bool haveAuthData)
|
||||
{
|
||||
set_widgetProtoShadowSocksEnabled(haveAuthData);
|
||||
set_pageEnabled(haveAuthData);
|
||||
set_pushButtonShadowSocksSaveVisible(haveAuthData);
|
||||
set_progressBarProtoShadowSocksResetVisible(haveAuthData);
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ class ShadowSocksLogic : public PageProtocolLogicBase
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
AUTO_PROPERTY(bool, widgetProtoShadowSocksEnabled)
|
||||
AUTO_PROPERTY(QString, comboBoxProtoShadowSocksCipherText)
|
||||
AUTO_PROPERTY(QString, lineEditProtoShadowSocksPortText)
|
||||
AUTO_PROPERTY(bool, pushButtonShadowSocksSaveVisible)
|
||||
|
|
|
@ -4,6 +4,7 @@ import QtQuick.Controls 2.12
|
|||
BasicButtonType {
|
||||
id: root
|
||||
property alias iconMargin: img.anchors.margins
|
||||
property alias img: img
|
||||
background: Item {}
|
||||
contentItem: Image {
|
||||
id: img
|
||||
|
|
|
@ -7,9 +7,8 @@ import "../Config"
|
|||
|
||||
Item {
|
||||
id: root
|
||||
property int page: PageEnum.Start
|
||||
property var page: PageEnum.Start
|
||||
property var logic: UiLogic
|
||||
enabled: logic.pageEnabled
|
||||
|
||||
// width: GC.screenWidth
|
||||
// height: GC.screenHeight
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.15
|
||||
import SortFilterProxyModel 0.2
|
||||
import PageEnum 1.0
|
||||
import "./"
|
||||
|
@ -82,7 +83,7 @@ PageBase {
|
|||
ListView {
|
||||
id: tb_c
|
||||
x: 10
|
||||
width: parent.width - 40
|
||||
width: parent.width - 10
|
||||
height: tb_c.contentItem.height
|
||||
currentIndex: -1
|
||||
spacing: 5
|
||||
|
@ -96,7 +97,7 @@ PageBase {
|
|||
Item {
|
||||
id: c_item
|
||||
width: parent.width
|
||||
height: lb_container_name.height + tb_p.height
|
||||
height: row_container.height + tb_p.height
|
||||
anchors.left: parent.left
|
||||
Rectangle {
|
||||
anchors.top: parent.top
|
||||
|
@ -106,47 +107,108 @@ PageBase {
|
|||
visible: index !== tb_c.currentIndex
|
||||
}
|
||||
Rectangle {
|
||||
anchors.top: lb_container_name.top
|
||||
anchors.bottom: lb_container_name.bottom
|
||||
anchors.top: row_container.top
|
||||
anchors.bottom: row_container.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
color: "#63B4FB"
|
||||
visible: index === tb_c.currentIndex
|
||||
}
|
||||
Text {
|
||||
id: lb_container_name
|
||||
text: name_role
|
||||
font.pixelSize: 17
|
||||
//font.bold: true
|
||||
color: "#100A44"
|
||||
topPadding: 5
|
||||
bottomPadding: 5
|
||||
leftPadding: 10
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.top: lb_container_name.top
|
||||
anchors.bottom: lb_container_name.bottom
|
||||
// ImageButtonType {
|
||||
// id: button_default1
|
||||
// z:10
|
||||
|
||||
// Layout.alignment: Qt.AlignRight
|
||||
// checkable: true
|
||||
// img.source: checked ? "qrc:/images/check.png" : "qrc:/images/uncheck.png"
|
||||
// width: 20
|
||||
// img.width: 20
|
||||
// height: 20
|
||||
|
||||
// checked: default_role
|
||||
// onClicked: {
|
||||
// ServerContainersLogic.onPushButtonDefaultClicked(proxyContainersModel.mapToSource(index))
|
||||
// }
|
||||
// }
|
||||
|
||||
RowLayout {
|
||||
id: row_container
|
||||
//width: parent.width
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
propagateComposedEvents: true
|
||||
onClicked: {
|
||||
tb_c.currentIndex = index
|
||||
UiLogic.protocolsModel.setSelectedDockerContainer(proxyContainersModel.mapToSource(index))
|
||||
//container_selector.containerSelected(index)
|
||||
//root.close()
|
||||
|
||||
// anchors.top: lb_container_name.top
|
||||
// anchors.bottom: lb_container_name.bottom
|
||||
|
||||
Text {
|
||||
id: lb_container_name
|
||||
text: name_role
|
||||
font.pixelSize: 17
|
||||
//font.bold: true
|
||||
color: "#100A44"
|
||||
topPadding: 5
|
||||
bottomPadding: 5
|
||||
leftPadding: 10
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
wrapMode: Text.WordWrap
|
||||
Layout.fillWidth: true
|
||||
|
||||
MouseArea {
|
||||
anchors.top: lb_container_name.top
|
||||
anchors.bottom: lb_container_name.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
propagateComposedEvents: true
|
||||
onClicked: {
|
||||
if (tb_c.currentIndex === index) tb_c.currentIndex = -1
|
||||
else tb_c.currentIndex = index
|
||||
|
||||
UiLogic.protocolsModel.setSelectedDockerContainer(proxyContainersModel.mapToSource(index))
|
||||
//ServerContainersLogic.setSelectedDockerContainer(proxyContainersModel.mapToSource(index))
|
||||
|
||||
//container_selector.containerSelected(index)
|
||||
//root.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImageButtonType {
|
||||
id: button_default
|
||||
|
||||
Layout.alignment: Qt.AlignRight
|
||||
checkable: true
|
||||
img.source: checked ? "qrc:/images/check.png" : "qrc:/images/uncheck.png"
|
||||
implicitWidth: 30
|
||||
implicitHeight: 30
|
||||
|
||||
checked: default_role
|
||||
onClicked: {
|
||||
ServerContainersLogic.onPushButtonDefaultClicked(proxyContainersModel.mapToSource(index))
|
||||
}
|
||||
}
|
||||
|
||||
ImageButtonType {
|
||||
id: button_share
|
||||
Layout.alignment: Qt.AlignRight
|
||||
icon.source: "qrc:/images/share.png"
|
||||
implicitWidth: 30
|
||||
implicitHeight: 30
|
||||
onClicked: {
|
||||
ServerContainersLogic.onPushButtonShareClicked(proxyContainersModel.mapToSource(index))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
ListView {
|
||||
id: tb_p
|
||||
currentIndex: -1
|
||||
visible: index === tb_c.currentIndex
|
||||
x: 10
|
||||
anchors.top: lb_container_name.bottom
|
||||
anchors.top: row_container.bottom
|
||||
|
||||
width: parent.width - 40
|
||||
height: visible ? tb_p.contentItem.height : 0
|
||||
|
|
|
@ -19,7 +19,7 @@ PageProtocolBase {
|
|||
y: 40
|
||||
width: 380
|
||||
height: 600
|
||||
enabled: logic.widgetProtoCloakEnabled
|
||||
enabled: logic.pageEnabled
|
||||
ComboBoxType {
|
||||
x: 190
|
||||
y: 60
|
||||
|
|
|
@ -18,7 +18,7 @@ PageProtocolBase {
|
|||
y: 40
|
||||
width: 380
|
||||
height: 600
|
||||
enabled: logic.widgetProtoOpenVpnEnabled
|
||||
enabled: logic.pageEnabled
|
||||
CheckBoxType {
|
||||
x: 30
|
||||
y: 280
|
||||
|
|
|
@ -19,28 +19,32 @@ PageProtocolBase {
|
|||
y: 40
|
||||
width: 380
|
||||
height: 600
|
||||
enabled: logic.widgetProtoShadowSocksEnabled
|
||||
enabled: logic.pageEnabled
|
||||
ComboBoxType {
|
||||
x: 190
|
||||
y: 60
|
||||
width: 151
|
||||
height: 31
|
||||
model: [
|
||||
qsTr("chacha20-poly1305"),
|
||||
model: [
|
||||
qsTr("chacha20-ietf-poly1305"),
|
||||
qsTr("xchacha20-ietf-poly1305"),
|
||||
qsTr("aes-256-gcm"),
|
||||
qsTr("aes-192-gcm"),
|
||||
qsTr("aes-128-gcm")
|
||||
]
|
||||
currentIndex: {
|
||||
console.debug("logic.comboBoxProtoShadowSocksCipherText " + logic.comboBoxProtoShadowSocksCipherText)
|
||||
for (let i = 0; i < model.length; ++i) {
|
||||
console.debug("check " + model[i])
|
||||
if (logic.comboBoxProtoShadowSocksCipherText === model[i]) {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
onCurrentTextChanged: {
|
||||
logic.comboBoxProtoShadowSocksCipherText = currentText
|
||||
}
|
||||
// onCurrentTextChanged: {
|
||||
// logic.comboBoxProtoShadowSocksCipherText = currentText
|
||||
// }
|
||||
}
|
||||
LabelType {
|
||||
x: 30
|
||||
|
|
|
@ -8,6 +8,6 @@ import "../../Config"
|
|||
|
||||
PageBase {
|
||||
id: root
|
||||
property int protocol: ProtocolEnum.Any
|
||||
property var protocol: ProtocolEnum.Any
|
||||
page: PageEnum.ProtocolSettings
|
||||
}
|
||||
|
|
|
@ -73,6 +73,7 @@ Window {
|
|||
VpnLogic.updateVpnPage()
|
||||
}
|
||||
}
|
||||
|
||||
if (slide) {
|
||||
pageLoader.push(pages[page], {}, StackView.PushTransition)
|
||||
} else {
|
||||
|
@ -84,6 +85,7 @@ Window {
|
|||
if (reset) {
|
||||
protocolPages[protocol].logic.updatePage();
|
||||
}
|
||||
|
||||
if (slide) {
|
||||
pageLoader.push(protocolPages[protocol], {}, StackView.PushTransition)
|
||||
} else {
|
||||
|
@ -199,13 +201,9 @@ Window {
|
|||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
PageProtoOpenVPN {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function createPagesObjects(file, isProtocol) {
|
||||
if (file.indexOf("Base") !== -1) return; // skip Base Pages
|
||||
|
||||
var c = Qt.createComponent("qrc" + file);
|
||||
|
||||
var finishCreation = function (component){
|
||||
|
@ -218,10 +216,13 @@ Window {
|
|||
obj.visible = false
|
||||
if (isProtocol) {
|
||||
protocolPages[obj.protocol] = obj
|
||||
console.debug("QML add proto page " + obj.protocol)
|
||||
console.debug("PPP " + obj.protocol + " " + file)
|
||||
|
||||
}
|
||||
else {
|
||||
pages[obj.page] = obj
|
||||
console.debug("AAA " + obj.page + " " + file)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -242,9 +243,11 @@ Window {
|
|||
Connections {
|
||||
target: UiLogic
|
||||
onGoToPage: {
|
||||
console.debug("Connections onGoToPage " + page);
|
||||
root.gotoPage(page, reset, slide)
|
||||
}
|
||||
onGoToProtocolPage: {
|
||||
console.debug("Connections onGoToProtocolPage " + protocol);
|
||||
root.gotoProtocolPage(protocol, reset, slide)
|
||||
}
|
||||
onClosePage: {
|
||||
|
|
|
@ -120,10 +120,14 @@ void UiLogic::initalizeUiLogic()
|
|||
// }
|
||||
|
||||
// Post initialization
|
||||
goToPage(Page::Start, true, false);
|
||||
//emit goToPage(Page::Start, true, false);
|
||||
|
||||
if (m_settings.defaultServerIndex() >= 0 && m_settings.serversCount() > 0) {
|
||||
goToPage(Page::Vpn, true, false);
|
||||
if (m_settings.serversCount() > 0) {
|
||||
if (m_settings.defaultServerIndex() < 0) m_settings.setDefaultServer(0);
|
||||
emit goToPage(Page::Vpn, true, false);
|
||||
}
|
||||
else {
|
||||
emit goToPage(Page::Start, true, false);
|
||||
}
|
||||
|
||||
selectedServerIndex = m_settings.defaultServerIndex();
|
||||
|
@ -131,7 +135,7 @@ void UiLogic::initalizeUiLogic()
|
|||
//goToPage(Page::NewServerProtocols, true, false);
|
||||
|
||||
|
||||
// //ui->pushButton_general_settings_exit->hide();
|
||||
//ui->pushButton_general_settings_exit->hide();
|
||||
|
||||
|
||||
qInfo().noquote() << QString("Started %1 version %2").arg(APPLICATION_NAME).arg(APP_VERSION);
|
||||
|
|
|
@ -105,10 +105,10 @@ signals:
|
|||
void dialogConnectErrorTextChanged();
|
||||
|
||||
|
||||
void goToPage(int page, bool reset = true, bool slide = true);
|
||||
void goToProtocolPage(int protocol, bool reset = true, bool slide = true);
|
||||
void goToPage(PageEnumNS::Page page, bool reset = true, bool slide = true);
|
||||
void goToProtocolPage(Protocol protocol, bool reset = true, bool slide = true);
|
||||
void closePage();
|
||||
void setStartPage(int page, bool slide = true);
|
||||
void setStartPage(PageEnumNS::Page page, bool slide = true);
|
||||
void showPublicKeyWarning();
|
||||
void showConnectErrorDialog();
|
||||
void show();
|
||||
|
@ -179,7 +179,7 @@ public:
|
|||
VpnLogic *vpnLogic() { return m_vpnLogic; }
|
||||
WizardLogic *wizardLogic() { return m_wizardLogic; }
|
||||
|
||||
Q_INVOKABLE PageProtocolLogicBase *protocolLogic(amnezia::Protocol p) { return m_protocolLogicMap.value(p); }
|
||||
Q_INVOKABLE PageProtocolLogicBase *protocolLogic(Protocol p) { return m_protocolLogicMap.value(p); }
|
||||
|
||||
private:
|
||||
AppSettingsLogic *m_appSettingsLogic;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue