fort/src/ui/qml/pages/MainPage.qml

110 lines
2.8 KiB
QML
Raw Normal View History

2017-09-03 05:57:35 +00:00
import QtQuick 2.9
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.2
import com.fortfirewall 1.0
Page {
2017-09-03 06:49:58 +00:00
id: mainPage
2017-09-04 11:39:15 +00:00
signal opened()
signal closed()
2017-09-03 06:49:58 +00:00
signal saved()
2017-09-03 05:57:35 +00:00
2017-09-07 05:34:18 +00:00
property bool confFlagsEdited
property bool confEdited
function setConfFlagsEdited() {
confFlagsEdited = true;
}
function setConfEdited() {
confEdited = true;
}
function resetConfEdited() {
confFlagsEdited = false;
confEdited = false;
}
2017-09-04 11:39:15 +00:00
onOpened: {
2017-09-07 05:34:18 +00:00
resetConfEdited();
2017-09-03 05:57:35 +00:00
tabBar.currentItem.forceActiveFocus();
}
header: TabBar {
id: tabBar
currentIndex: swipeView.currentIndex
TabButton {
2017-09-06 10:24:03 +00:00
icon.source: "qrc:/images/cog.png"
2017-09-07 10:44:15 +00:00
text: translationManager.dummyBool
&& qsTranslate("qml", "Options")
2017-09-03 05:57:35 +00:00
}
TabButton {
2017-09-06 10:24:03 +00:00
icon.source: "qrc:/images/link.png"
2017-09-07 10:44:15 +00:00
text: translationManager.dummyBool
&& qsTranslate("qml", "IPv4 Addresses")
2017-09-03 05:57:35 +00:00
}
TabButton {
2017-09-06 10:24:03 +00:00
icon.source: "qrc:/images/application_cascade.png"
2017-09-07 10:44:15 +00:00
text: translationManager.dummyBool
&& qsTranslate("qml", "Applications")
2017-09-03 05:57:35 +00:00
}
TabButton {
2017-09-06 10:24:03 +00:00
icon.source: "qrc:/images/zoom.png"
2017-09-07 10:44:15 +00:00
text: translationManager.dummyBool
&& qsTranslate("qml", "Activity")
2017-09-03 05:57:35 +00:00
}
}
SwipeView {
id: swipeView
anchors.fill: parent
currentIndex: tabBar.currentIndex
OptionsPage {}
AddressesPage {}
ApplicationsPage {}
ActivityPage {}
}
footer: Pane {
RowLayout {
anchors.right: parent.right
Button {
2017-09-07 05:34:18 +00:00
enabled: confFlagsEdited || confEdited
2017-09-07 10:44:15 +00:00
text: translationManager.dummyBool
&& qsTranslate("qml", "OK")
2017-09-03 05:57:35 +00:00
onClicked: {
2017-09-07 05:34:18 +00:00
if (fortManager.saveConf(confFlagsEdited)) {
2017-09-03 06:49:58 +00:00
mainPage.saved();
2017-09-03 05:57:35 +00:00
closeWindow();
2017-09-03 06:49:58 +00:00
}
2017-09-03 05:57:35 +00:00
}
}
Button {
2017-09-07 05:34:18 +00:00
enabled: confFlagsEdited || confEdited
2017-09-07 10:44:15 +00:00
text: translationManager.dummyBool
&& qsTranslate("qml", "Apply")
2017-09-07 05:34:18 +00:00
onClicked: {
if (fortManager.applyConf(confFlagsEdited)) {
resetConfEdited();
}
}
2017-09-03 05:57:35 +00:00
}
Button {
2017-09-07 10:44:15 +00:00
text: translationManager.dummyBool
&& qsTranslate("qml", "Cancel")
2017-09-03 05:57:35 +00:00
onClicked: closeWindow()
}
Button {
2017-09-07 10:44:15 +00:00
text: translationManager.dummyBool
&& qsTranslate("qml", "Quit")
2017-09-06 08:39:20 +00:00
onClicked: fortManager.exit()
2017-09-03 05:57:35 +00:00
}
}
}
}