Merge pull request #125 from amnezia-vpn/qt_migration-settings-btn
Added Settings button on Start Page
This commit is contained in:
commit
c8010d4d52
6 changed files with 32 additions and 4 deletions
|
|
@ -13,6 +13,7 @@ GeneralSettingsLogic::GeneralSettingsLogic(UiLogic *logic, QObject *parent):
|
||||||
void GeneralSettingsLogic::onUpdatePage()
|
void GeneralSettingsLogic::onUpdatePage()
|
||||||
{
|
{
|
||||||
uiLogic()->selectedServerIndex = m_settings->defaultServerIndex();
|
uiLogic()->selectedServerIndex = m_settings->defaultServerIndex();
|
||||||
|
set_existsAnyServer(uiLogic()->selectedServerIndex >= 0);
|
||||||
uiLogic()->selectedDockerContainer = m_settings->defaultContainer(m_settings->defaultServerIndex());
|
uiLogic()->selectedDockerContainer = m_settings->defaultContainer(m_settings->defaultServerIndex());
|
||||||
|
|
||||||
set_pushButtonGeneralSettingsShareConnectionEnable(m_settings->haveAuthData(m_settings->defaultServerIndex()));
|
set_pushButtonGeneralSettingsShareConnectionEnable(m_settings->haveAuthData(m_settings->defaultServerIndex()));
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ class GeneralSettingsLogic : public PageLogicBase
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
AUTO_PROPERTY(bool, pushButtonGeneralSettingsShareConnectionEnable)
|
AUTO_PROPERTY(bool, pushButtonGeneralSettingsShareConnectionEnable)
|
||||||
|
AUTO_PROPERTY(bool, existsAnyServer)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Q_INVOKABLE void onUpdatePage() override;
|
Q_INVOKABLE void onUpdatePage() override;
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,12 @@ BasicButtonType {
|
||||||
|
|
||||||
background: Item {}
|
background: Item {}
|
||||||
contentItem: Item {
|
contentItem: Item {
|
||||||
anchors.fill: parent
|
// anchors.fill: parent
|
||||||
SvgImageType {
|
SvgImageType {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
svg.source: root.icon.source
|
svg.source: root.icon.source
|
||||||
|
enabled: root.enabled
|
||||||
color: "#100A44"
|
color: "#100A44"
|
||||||
width: 25
|
width: 25
|
||||||
height: 25
|
height: 25
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,6 @@ Item {
|
||||||
ColorOverlay {
|
ColorOverlay {
|
||||||
anchors.fill: image
|
anchors.fill: image
|
||||||
source: image
|
source: image
|
||||||
color: root.color
|
color: root.enabled ? root.color : "grey"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,7 @@ PageBase {
|
||||||
Layout.preferredHeight: 30
|
Layout.preferredHeight: 30
|
||||||
icon.source: "qrc:/images/svg/vpn_key_black_24dp.svg"
|
icon.source: "qrc:/images/svg/vpn_key_black_24dp.svg"
|
||||||
text: qsTr("Server Settings")
|
text: qsTr("Server Settings")
|
||||||
|
enabled: GeneralSettingsLogic.existsAnyServer
|
||||||
onClicked: {
|
onClicked: {
|
||||||
GeneralSettingsLogic.onPushButtonGeneralSettingsServerSettingsClicked()
|
GeneralSettingsLogic.onPushButtonGeneralSettingsServerSettingsClicked()
|
||||||
}
|
}
|
||||||
|
|
@ -101,7 +102,8 @@ PageBase {
|
||||||
Layout.preferredHeight: 30
|
Layout.preferredHeight: 30
|
||||||
icon.source: "qrc:/images/svg/share_black_24dp.svg"
|
icon.source: "qrc:/images/svg/share_black_24dp.svg"
|
||||||
text: qsTr("Share connection")
|
text: qsTr("Share connection")
|
||||||
enabled: GeneralSettingsLogic.pushButtonGeneralSettingsShareConnectionEnable
|
enabled: GeneralSettingsLogic.pushButtonGeneralSettingsShareConnectionEnable &&
|
||||||
|
GeneralSettingsLogic.existsAnyServer
|
||||||
onClicked: {
|
onClicked: {
|
||||||
GeneralSettingsLogic.onPushButtonGeneralSettingsShareConnectionClicked()
|
GeneralSettingsLogic.onPushButtonGeneralSettingsShareConnectionClicked()
|
||||||
}
|
}
|
||||||
|
|
@ -118,6 +120,7 @@ PageBase {
|
||||||
Layout.preferredHeight: 30
|
Layout.preferredHeight: 30
|
||||||
icon.source: "qrc:/images/svg/format_list_bulleted_black_24dp.svg"
|
icon.source: "qrc:/images/svg/format_list_bulleted_black_24dp.svg"
|
||||||
text: qsTr("Servers")
|
text: qsTr("Servers")
|
||||||
|
enabled: GeneralSettingsLogic.existsAnyServer
|
||||||
onClicked: {
|
onClicked: {
|
||||||
UiLogic.goToPage(PageEnum.ServersList)
|
UiLogic.goToPage(PageEnum.ServersList)
|
||||||
}
|
}
|
||||||
|
|
@ -135,7 +138,12 @@ PageBase {
|
||||||
icon.source: "qrc:/images/svg/control_point_black_24dp.svg"
|
icon.source: "qrc:/images/svg/control_point_black_24dp.svg"
|
||||||
text: qsTr("Add server")
|
text: qsTr("Add server")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
if(GeneralSettingsLogic.existsAnyServer)
|
||||||
|
// If there is any server set we will go to Start Page
|
||||||
UiLogic.goToPage(PageEnum.Start)
|
UiLogic.goToPage(PageEnum.Start)
|
||||||
|
else
|
||||||
|
// Else just come back to start page
|
||||||
|
UiLogic.closePage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,23 @@ PageBase {
|
||||||
visible: pageLoader.depth > 1
|
visible: pageLoader.depth > 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImageButtonType {
|
||||||
|
anchors {
|
||||||
|
right: parent.right
|
||||||
|
top: parent.top
|
||||||
|
}
|
||||||
|
|
||||||
|
width: 41
|
||||||
|
height: 41
|
||||||
|
imgMarginHover: 8
|
||||||
|
imgMargin: 9
|
||||||
|
icon.source: "qrc:/images/settings_grey.png"
|
||||||
|
visible: !GeneralSettingsLogic.existsAnyServer
|
||||||
|
onClicked: {
|
||||||
|
UiLogic.goToPage(PageEnum.GeneralSettings)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Caption {
|
Caption {
|
||||||
id: caption
|
id: caption
|
||||||
text: start_switch_page.checked ?
|
text: start_switch_page.checked ?
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue