summaryrefslogtreecommitdiff
path: root/gui/qml/BridgesItem.qml
blob: 1343403a51f7a3e6236223c403eece7d2ef53e10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import QtQuick 2.9
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.4

import "logic.js" as Logic

Item {

    anchors.centerIn: parent
    width: parent.width
    property alias displayReconnect: bridgeReconnect.visible
    // TODO get obfs4Available from backend, in case provider doesn't have it
    visible: true

    Column {

        anchors.centerIn: parent
        spacing: 10
        width: parent.width

        CheckBox {
            id: bridgeCheck
            checked: false
            text: qsTr("Use obfs4 bridges")
            font.pixelSize: 14
            anchors.horizontalCenter: parent.horizontalCenter
            onClicked: {
                if (checked) {
                    Logic.setNeedsReconnect(true);
                    bridgeReconnect.visible = true;
                    app.useBridges(true);
                } else {
                    // This would also need a "needs reconnect" for de-selecting bridges the next time.
                    // better to wait and see the new connection widgets though
                    Logic.setNeedsReconnect(false);
                    bridgeReconnect.visible = false;
                    app.useBridges(false);
                }
            }
        }

        Text {
            id: bridgesInfo
            width: 250
            color: "grey"
            text: qsTr("Select a bridge only if you know that you need it to evade censorship in your country or local network.")
            anchors.horizontalCenter: parent.horizontalCenter
            wrapMode: Text.WordWrap 
            visible: !bridgeReconnect.visible
        }

        Text {
            id: bridgeReconnect
            width: 250
            font.pixelSize: 12
            color: "red"
            text: qsTr("An obfs4 bridge will be used the next time you connect to the VPN.")
            anchors.horizontalCenter: parent.horizontalCenter
            wrapMode: Text.WordWrap 
            visible: false
        }
    }
}