add focus navigation to qml
This commit is contained in:
parent
cecee3769e
commit
01e31b4b4d
23 changed files with 103 additions and 196 deletions
|
|
@ -41,6 +41,11 @@ bool isLess(QObject* item1, QObject* item2)
|
||||||
return (p1.y() == p2.y()) ? (p1.x() < p2.x()) : (p1.y() < p2.y());
|
return (p1.y() == p2.y()) ? (p1.x() < p2.x()) : (p1.y() < p2.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isMore(QObject* item1, QObject* item2)
|
||||||
|
{
|
||||||
|
return !isLess(item1, item2);
|
||||||
|
}
|
||||||
|
|
||||||
bool isListView(QObject* item)
|
bool isListView(QObject* item)
|
||||||
{
|
{
|
||||||
return item->inherits("QQuickListView");
|
return item->inherits("QQuickListView");
|
||||||
|
|
@ -129,7 +134,7 @@ void printItems(const T& items, QObject* current_item)
|
||||||
QQuickItem* i = qobject_cast<QQuickItem*>(item);
|
QQuickItem* i = qobject_cast<QQuickItem*>(item);
|
||||||
QPointF coords {getItemCenterPointOnScene(i)};
|
QPointF coords {getItemCenterPointOnScene(i)};
|
||||||
QString prefix = current_item == i ? "==>" : " ";
|
QString prefix = current_item == i ? "==>" : " ";
|
||||||
// qDebug() << prefix << " Item: " << i << " with coords: " << coords; // Uncomment to visualize tab transitions
|
qDebug() << prefix << " Item: " << i << " with coords: " << coords;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -236,12 +241,12 @@ QQuickItem* ListViewFocusController::focusedItem()
|
||||||
void ListViewFocusController::focusNextItem()
|
void ListViewFocusController::focusNextItem()
|
||||||
{
|
{
|
||||||
if (m_focusChain.empty()) {
|
if (m_focusChain.empty()) {
|
||||||
qWarning() << "Empty focusChain with current delegate: " << currentDelegate();
|
qDebug() << "Empty focusChain with current delegate: " << currentDelegate();
|
||||||
m_focusChain = getSubChain(currentDelegate());
|
m_focusChain = getSubChain(currentDelegate());
|
||||||
}
|
}
|
||||||
m_focusedItemIndex++;
|
m_focusedItemIndex++;
|
||||||
m_focusedItem = qobject_cast<QQuickItem*>(m_focusChain.at(m_focusedItemIndex));
|
m_focusedItem = qobject_cast<QQuickItem*>(m_focusChain.at(m_focusedItemIndex));
|
||||||
m_focusedItem->forceActiveFocus();
|
m_focusedItem->forceActiveFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListViewFocusController::focusPreviousItem()
|
void ListViewFocusController::focusPreviousItem()
|
||||||
|
|
@ -287,6 +292,7 @@ void FocusController::resetFocus()
|
||||||
qWarning() << "There is no focusable elements";
|
qWarning() << "There is no focusable elements";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_focusedItemIndex == -1) {
|
if(m_focusedItemIndex == -1) {
|
||||||
m_focusedItemIndex = 0;
|
m_focusedItemIndex = 0;
|
||||||
m_focusedItem = qobject_cast<QQuickItem*>(m_focusChain.at(m_focusedItemIndex));
|
m_focusedItem = qobject_cast<QQuickItem*>(m_focusChain.at(m_focusedItemIndex));
|
||||||
|
|
@ -370,7 +376,7 @@ void FocusController::previousKeyTabItem()
|
||||||
m_focusedItem = qobject_cast<QQuickItem*>(m_focusChain.at(m_focusedItemIndex));
|
m_focusedItem = qobject_cast<QQuickItem*>(m_focusChain.at(m_focusedItemIndex));
|
||||||
m_focusedItem->forceActiveFocus(Qt::TabFocusReason);
|
m_focusedItem->forceActiveFocus(Qt::TabFocusReason);
|
||||||
|
|
||||||
qDebug() << "--> Current focus was changed to " << m_focusedItem;
|
qDebug() << "===>> Current focus was changed to " << m_focusedItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FocusController::nextKeyUpItem()
|
void FocusController::nextKeyUpItem()
|
||||||
|
|
@ -439,7 +445,8 @@ void FocusController::reload()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_focusedItemIndex = m_focusChain.indexOf(window->activeFocusItem());
|
m_focusedItemIndex = m_focusChain.indexOf(m_focusedItem);
|
||||||
|
// m_focusedItemIndex = m_focusChain.indexOf(window->activeFocusItem());
|
||||||
|
|
||||||
if(m_focusedItemIndex == -1) {
|
if(m_focusedItemIndex == -1) {
|
||||||
qInfo() << "No focus item in chain. Moving focus to begin...";
|
qInfo() << "No focus item in chain. Moving focus to begin...";
|
||||||
|
|
@ -447,9 +454,9 @@ void FocusController::reload()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_focusedItem = qobject_cast<QQuickItem*>(m_focusChain.at(m_focusedItemIndex));
|
// m_focusedItem = qobject_cast<QQuickItem*>(m_focusChain.at(m_focusedItemIndex));
|
||||||
|
|
||||||
m_focusedItem->forceActiveFocus();
|
// m_focusedItem->forceActiveFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FocusController::setRootItem(QQuickItem* item)
|
void FocusController::setRootItem(QQuickItem* item)
|
||||||
|
|
|
||||||
|
|
@ -37,11 +37,11 @@ DrawerType2 {
|
||||||
target: root
|
target: root
|
||||||
enabled: !GC.isMobile()
|
enabled: !GC.isMobile()
|
||||||
function onOpened() {
|
function onOpened() {
|
||||||
FocusController.setRoot(root)
|
FocusController.setRootItem(root)
|
||||||
}
|
}
|
||||||
|
|
||||||
function onClosed() {
|
function onClosed() {
|
||||||
FocusController.setRoot(null)
|
FocusController.setRootItem(null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,14 +23,14 @@ ListView {
|
||||||
interactive: false
|
interactive: false
|
||||||
|
|
||||||
activeFocusOnTab: true
|
activeFocusOnTab: true
|
||||||
Keys.onTabPressed: {
|
// Keys.onTabPressed: {
|
||||||
if (currentIndex < this.count - 1) {
|
// if (currentIndex < this.count - 1) {
|
||||||
this.incrementCurrentIndex()
|
// this.incrementCurrentIndex()
|
||||||
} else {
|
// } else {
|
||||||
currentIndex = 0
|
// currentIndex = 0
|
||||||
lastItemTabClickedSignal()
|
// lastItemTabClickedSignal()
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
onCurrentIndexChanged: {
|
onCurrentIndexChanged: {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
|
|
|
||||||
|
|
@ -10,16 +10,6 @@ FocusScope {
|
||||||
property string backButtonImage: "qrc:/images/controls/arrow-left.svg"
|
property string backButtonImage: "qrc:/images/controls/arrow-left.svg"
|
||||||
property var backButtonFunction
|
property var backButtonFunction
|
||||||
|
|
||||||
// property bool isFocusable: true
|
|
||||||
|
|
||||||
// Keys.onTabPressed: {
|
|
||||||
// FocusController.nextKeyTabItem()
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Keys.onBacktabPressed: {
|
|
||||||
// FocusController.previousKeyTabItem()
|
|
||||||
// }
|
|
||||||
|
|
||||||
implicitWidth: content.implicitWidth
|
implicitWidth: content.implicitWidth
|
||||||
implicitHeight: content.implicitHeight
|
implicitHeight: content.implicitHeight
|
||||||
|
|
||||||
|
|
@ -39,8 +29,6 @@ FocusScope {
|
||||||
implicitWidth: 40
|
implicitWidth: 40
|
||||||
implicitHeight: 40
|
implicitHeight: 40
|
||||||
|
|
||||||
// focus: true
|
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (backButtonFunction && typeof backButtonFunction === "function") {
|
if (backButtonFunction && typeof backButtonFunction === "function") {
|
||||||
backButtonFunction()
|
backButtonFunction()
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,6 @@ Button {
|
||||||
focusPolicy: Qt.TabFocus
|
focusPolicy: Qt.TabFocus
|
||||||
|
|
||||||
onFocusChanged: {
|
onFocusChanged: {
|
||||||
console.debug("===>> BUTTON: active.focus: ", root.activeFocus, " parentFlickable: ", root.parentFlickable )
|
|
||||||
if (root.activeFocus) {
|
if (root.activeFocus) {
|
||||||
if (root.parentFlickable) {
|
if (root.parentFlickable) {
|
||||||
root.parentFlickable.ensureVisible(this)
|
root.parentFlickable.ensureVisible(this)
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@ Button {
|
||||||
|
|
||||||
property alias focusItem: rightImage
|
property alias focusItem: rightImage
|
||||||
|
|
||||||
|
property FlickableType parentFlickable
|
||||||
|
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
|
|
@ -42,6 +44,22 @@ Button {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ensureVisible(item) {
|
||||||
|
if (item.activeFocus) {
|
||||||
|
if (root.parentFlickable) {
|
||||||
|
root.parentFlickable.ensureVisible(root)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onFocusChanged: {
|
||||||
|
ensureVisible(root)
|
||||||
|
}
|
||||||
|
|
||||||
|
focusItem.onFocusChanged: {
|
||||||
|
root.ensureVisible(focusItem)
|
||||||
|
}
|
||||||
|
|
||||||
contentItem: Item {
|
contentItem: Item {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,8 @@ Item {
|
||||||
// Set a timer to set focus after a short delay
|
// Set a timer to set focus after a short delay
|
||||||
Timer {
|
Timer {
|
||||||
id: timer
|
id: timer
|
||||||
interval: 1000 // Milliseconds // TODO: return to 500
|
interval: 500 // Milliseconds
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
console.debug("===>> Page creation completed")
|
|
||||||
FocusController.resetFocus()
|
FocusController.resetFocus()
|
||||||
}
|
}
|
||||||
repeat: false // Stop the timer after one trigger
|
repeat: false // Stop the timer after one trigger
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,11 @@ Popup {
|
||||||
}
|
}
|
||||||
|
|
||||||
onOpened: {
|
onOpened: {
|
||||||
FocusController.setRoot(root)
|
FocusController.setRootItem(root)
|
||||||
}
|
}
|
||||||
|
|
||||||
onClosed: {
|
onClosed: {
|
||||||
FocusController.setRoot(null)
|
FocusController.setRootItem(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ Item {
|
||||||
implicitHeight: content.implicitHeight
|
implicitHeight: content.implicitHeight
|
||||||
|
|
||||||
property FlickableType parentFlickable
|
property FlickableType parentFlickable
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: textField
|
target: textField
|
||||||
function onFocusChanged() {
|
function onFocusChanged() {
|
||||||
|
|
@ -84,7 +85,7 @@ Item {
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id: textField
|
id: textField
|
||||||
// activeFocusOnTab: false
|
|
||||||
property bool isFocusable: true
|
property bool isFocusable: true
|
||||||
|
|
||||||
Keys.onTabPressed: {
|
Keys.onTabPressed: {
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,6 @@ PageType {
|
||||||
|
|
||||||
checkEmptyText: true
|
checkEmptyText: true
|
||||||
|
|
||||||
Keys.onTabPressed: saveButton.forceActiveFocus()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Header2TextType {
|
Header2TextType {
|
||||||
|
|
@ -283,7 +282,6 @@ PageType {
|
||||||
|
|
||||||
text: qsTr("Save")
|
text: qsTr("Save")
|
||||||
|
|
||||||
Keys.onTabPressed: lastItemTabClicked(focusItem)
|
|
||||||
|
|
||||||
clickedFunc: function() {
|
clickedFunc: function() {
|
||||||
forceActiveFocus()
|
forceActiveFocus()
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,6 @@ PageType {
|
||||||
Layout.bottomMargin: 24
|
Layout.bottomMargin: 24
|
||||||
|
|
||||||
text: qsTr("Save")
|
text: qsTr("Save")
|
||||||
Keys.onTabPressed: lastItemTabClicked(focusItem)
|
|
||||||
|
|
||||||
clickedFunc: function() {
|
clickedFunc: function() {
|
||||||
forceActiveFocus()
|
forceActiveFocus()
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import "../Config"
|
||||||
PageType {
|
PageType {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
FlickableType { // TODO: refactor either replace with ListView or Repeater
|
FlickableType {
|
||||||
id: fl
|
id: fl
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
|
|
@ -142,7 +142,6 @@ PageType {
|
||||||
text: qsTr("Close application")
|
text: qsTr("Close application")
|
||||||
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
||||||
leftImageSource: "qrc:/images/controls/x-circle.svg"
|
leftImageSource: "qrc:/images/controls/x-circle.svg"
|
||||||
// isLeftImageHoverEnabled: false
|
|
||||||
|
|
||||||
clickedFunction: function() {
|
clickedFunction: function() {
|
||||||
PageController.closeApplication()
|
PageController.closeApplication()
|
||||||
|
|
|
||||||
|
|
@ -14,17 +14,6 @@ import "../Components"
|
||||||
PageType {
|
PageType {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
// Item {
|
|
||||||
// id: focusItem
|
|
||||||
// KeyNavigation.tab: backButton
|
|
||||||
|
|
||||||
// onFocusChanged: {
|
|
||||||
// if (focusItem.activeFocus) {
|
|
||||||
// fl.contentY = 0
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
BackButtonType {
|
BackButtonType {
|
||||||
id: backButton
|
id: backButton
|
||||||
|
|
||||||
|
|
@ -223,7 +212,6 @@ PageType {
|
||||||
|
|
||||||
text: qsTr("Privacy Policy")
|
text: qsTr("Privacy Policy")
|
||||||
|
|
||||||
Keys.onTabPressed: lastItemTabClicked()
|
|
||||||
parentFlickable: fl
|
parentFlickable: fl
|
||||||
|
|
||||||
clickedFunc: function() {
|
clickedFunc: function() {
|
||||||
|
|
|
||||||
|
|
@ -14,16 +14,6 @@ import "../Components"
|
||||||
PageType {
|
PageType {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
// Item {
|
|
||||||
// id: focusItem
|
|
||||||
|
|
||||||
// onFocusChanged: {
|
|
||||||
// if (focusItem.activeFocus) {
|
|
||||||
// fl.contentY = 0
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
BackButtonType {
|
BackButtonType {
|
||||||
id: backButton
|
id: backButton
|
||||||
|
|
||||||
|
|
@ -31,8 +21,6 @@ PageType {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.topMargin: 20
|
anchors.topMargin: 20
|
||||||
|
|
||||||
// KeyNavigation.tab: GC.isMobile() ? switcher : switcherAutoStart
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FlickableType {
|
FlickableType {
|
||||||
|
|
@ -92,7 +80,6 @@ PageType {
|
||||||
descriptionText: qsTr("Enable notifications to show the VPN state in the status bar")
|
descriptionText: qsTr("Enable notifications to show the VPN state in the status bar")
|
||||||
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
||||||
|
|
||||||
// KeyNavigation.tab: labelWithButtonLanguage.rightButton
|
|
||||||
parentFlickable: fl
|
parentFlickable: fl
|
||||||
|
|
||||||
clickedFunction: function() {
|
clickedFunction: function() {
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,6 @@ import "../Controls2/TextTypes"
|
||||||
PageType {
|
PageType {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
// defaultActiveFocusItem: focusItem
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: SettingsController
|
target: SettingsController
|
||||||
|
|
||||||
|
|
@ -86,6 +84,8 @@ PageType {
|
||||||
|
|
||||||
text: qsTr("Make a backup")
|
text: qsTr("Make a backup")
|
||||||
|
|
||||||
|
parentFlickable: fl
|
||||||
|
|
||||||
clickedFunc: function() {
|
clickedFunc: function() {
|
||||||
var fileName = ""
|
var fileName = ""
|
||||||
if (GC.isMobile()) {
|
if (GC.isMobile()) {
|
||||||
|
|
@ -120,6 +120,8 @@ PageType {
|
||||||
|
|
||||||
text: qsTr("Restore from backup")
|
text: qsTr("Restore from backup")
|
||||||
|
|
||||||
|
parentFlickable: fl
|
||||||
|
|
||||||
clickedFunc: function() {
|
clickedFunc: function() {
|
||||||
var filePath = SystemController.getFileName(qsTr("Open backup file"),
|
var filePath = SystemController.getFileName(qsTr("Open backup file"),
|
||||||
qsTr("Backup files (*.backup)"))
|
qsTr("Backup files (*.backup)"))
|
||||||
|
|
@ -127,8 +129,6 @@ PageType {
|
||||||
restoreBackup(filePath)
|
restoreBackup(filePath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onTabPressed: lastItemTabClicked()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,8 @@ PageType {
|
||||||
descriptionText: qsTr("When AmneziaDNS is not used or installed")
|
descriptionText: qsTr("When AmneziaDNS is not used or installed")
|
||||||
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
||||||
|
|
||||||
|
parentFlickable: fl
|
||||||
|
|
||||||
clickedFunction: function() {
|
clickedFunction: function() {
|
||||||
PageController.goToPage(PageEnum.PageSettingsDns)
|
PageController.goToPage(PageEnum.PageSettingsDns)
|
||||||
}
|
}
|
||||||
|
|
@ -85,19 +87,11 @@ PageType {
|
||||||
descriptionText: qsTr("Allows you to select which sites you want to access through the VPN")
|
descriptionText: qsTr("Allows you to select which sites you want to access through the VPN")
|
||||||
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
||||||
|
|
||||||
|
parentFlickable: fl
|
||||||
|
|
||||||
clickedFunction: function() {
|
clickedFunction: function() {
|
||||||
PageController.goToPage(PageEnum.PageSettingsSplitTunneling)
|
PageController.goToPage(PageEnum.PageSettingsSplitTunneling)
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onTabPressed: {
|
|
||||||
if (splitTunnelingButton2.visible) {
|
|
||||||
return splitTunnelingButton2.rightButton.forceActiveFocus()
|
|
||||||
} else if (killSwitchSwitcher.visible) {
|
|
||||||
return killSwitchSwitcher.forceActiveFocus()
|
|
||||||
} else {
|
|
||||||
lastItemTabClicked()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DividerType {
|
DividerType {
|
||||||
|
|
@ -114,17 +108,11 @@ PageType {
|
||||||
descriptionText: qsTr("Allows you to use the VPN only for certain Apps")
|
descriptionText: qsTr("Allows you to use the VPN only for certain Apps")
|
||||||
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
||||||
|
|
||||||
|
parentFlickable: fl
|
||||||
|
|
||||||
clickedFunction: function() {
|
clickedFunction: function() {
|
||||||
PageController.goToPage(PageEnum.PageSettingsAppSplitTunneling)
|
PageController.goToPage(PageEnum.PageSettingsAppSplitTunneling)
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onTabPressed: {
|
|
||||||
if (killSwitchSwitcher.visible) {
|
|
||||||
return killSwitchSwitcher.forceActiveFocus()
|
|
||||||
} else {
|
|
||||||
lastItemTabClicked()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DividerType {
|
DividerType {
|
||||||
|
|
@ -141,6 +129,8 @@ PageType {
|
||||||
text: qsTr("KillSwitch")
|
text: qsTr("KillSwitch")
|
||||||
descriptionText: qsTr("Disables your internet if your encrypted VPN connection drops out for any reason.")
|
descriptionText: qsTr("Disables your internet if your encrypted VPN connection drops out for any reason.")
|
||||||
|
|
||||||
|
parentFlickable: fl
|
||||||
|
|
||||||
checked: SettingsController.isKillSwitchEnabled()
|
checked: SettingsController.isKillSwitchEnabled()
|
||||||
checkable: !ConnectionController.isConnected
|
checkable: !ConnectionController.isConnected
|
||||||
onCheckedChanged: {
|
onCheckedChanged: {
|
||||||
|
|
@ -153,8 +143,6 @@ PageType {
|
||||||
PageController.showNotificationMessage(qsTr("Cannot change killSwitch settings during active connection"))
|
PageController.showNotificationMessage(qsTr("Cannot change killSwitch settings during active connection"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onTabPressed: lastItemTabClicked()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DividerType {
|
DividerType {
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,20 @@ PageType {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.topMargin: 20
|
anchors.topMargin: 20
|
||||||
|
|
||||||
|
onFocusChanged: {
|
||||||
|
console.debug("MOVE THIS LOGIC TO CPP!")
|
||||||
|
if (activeFocus) {
|
||||||
|
if (fl) {
|
||||||
|
fl.ensureVisible(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FlickableType {
|
FlickableType {
|
||||||
id: fl
|
id: fl
|
||||||
|
|
||||||
anchors.top: backButton.bottom
|
anchors.top: backButton.bottom
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
contentHeight: content.height
|
contentHeight: content.height
|
||||||
|
|
@ -51,6 +61,7 @@ PageType {
|
||||||
|
|
||||||
SwitcherType {
|
SwitcherType {
|
||||||
id: switcher
|
id: switcher
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 16
|
Layout.topMargin: 16
|
||||||
Layout.leftMargin: 16
|
Layout.leftMargin: 16
|
||||||
|
|
@ -66,14 +77,7 @@ PageType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onFocusChanged: {
|
parentFlickable: fl
|
||||||
console.debug("MOVE THIS LOGIC TO CPP!")
|
|
||||||
if (activeFocus) {
|
|
||||||
if (fl) {
|
|
||||||
fl.ensureVisible(this)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DividerType {}
|
DividerType {}
|
||||||
|
|
|
||||||
|
|
@ -52,25 +52,13 @@ PageType {
|
||||||
|
|
||||||
height: 500 // servers.contentItem.height // TODO: calculate height
|
height: 500 // servers.contentItem.height // TODO: calculate height
|
||||||
|
|
||||||
|
property bool isFocusable: true
|
||||||
|
|
||||||
model: ServersModel
|
model: ServersModel
|
||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
interactive: false
|
interactive: false
|
||||||
|
|
||||||
// activeFocusOnTab: true
|
|
||||||
// focus: true
|
|
||||||
// Keys.onTabPressed: {
|
|
||||||
// if (currentIndex < servers.count - 1) {
|
|
||||||
// servers.incrementCurrentIndex()
|
|
||||||
// } else {
|
|
||||||
// servers.currentIndex = 0
|
|
||||||
// focusItem.forceActiveFocus()
|
|
||||||
// root.lastItemTabClicked()
|
|
||||||
// }
|
|
||||||
|
|
||||||
// fl.ensureVisible(this.currentItem)
|
|
||||||
// }
|
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
currentIndex = 0
|
currentIndex = 0
|
||||||
|
|
@ -81,12 +69,6 @@ PageType {
|
||||||
implicitWidth: servers.width
|
implicitWidth: servers.width
|
||||||
implicitHeight: delegateContent.implicitHeight
|
implicitHeight: delegateContent.implicitHeight
|
||||||
|
|
||||||
// onFocusChanged: {
|
|
||||||
// if (focus) {
|
|
||||||
// server.rightButton.forceActiveFocus()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: delegateContent
|
id: delegateContent
|
||||||
|
|
||||||
|
|
@ -99,7 +81,7 @@ PageType {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
text: name
|
text: name
|
||||||
// parentFlickable: fl
|
|
||||||
descriptionText: {
|
descriptionText: {
|
||||||
var servicesNameString = ""
|
var servicesNameString = ""
|
||||||
var servicesName = ServersModel.getAllInstalledServicesName(index)
|
var servicesName = ServersModel.getAllInstalledServicesName(index)
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,8 @@ PageType {
|
||||||
height: containers.contentItem.height
|
height: containers.contentItem.height
|
||||||
spacing: 16
|
spacing: 16
|
||||||
|
|
||||||
|
property bool isFocusable: true
|
||||||
|
|
||||||
currentIndex: 1
|
currentIndex: 1
|
||||||
interactive: false
|
interactive: false
|
||||||
model: ApiServicesModel
|
model: ApiServicesModel
|
||||||
|
|
@ -85,6 +87,9 @@ PageType {
|
||||||
PageController.goToPage(PageEnum.PageSetupWizardApiServiceInfo)
|
PageController.goToPage(PageEnum.PageSetupWizardApiServiceInfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Keys.onEnterPressed: clicked()
|
||||||
|
Keys.onReturnPressed: clicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,6 @@ PageType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// defaultActiveFocusItem: focusItem
|
|
||||||
|
|
||||||
FlickableType {
|
FlickableType {
|
||||||
id: fl
|
id: fl
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
|
|
@ -136,6 +134,8 @@ PageType {
|
||||||
}
|
}
|
||||||
|
|
||||||
ParagraphTextType {
|
ParagraphTextType {
|
||||||
|
objectName: "insertKeyLabel"
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 32
|
Layout.topMargin: 32
|
||||||
Layout.rightMargin: 16
|
Layout.rightMargin: 16
|
||||||
|
|
@ -155,6 +155,8 @@ PageType {
|
||||||
headerText: qsTr("Insert key")
|
headerText: qsTr("Insert key")
|
||||||
buttonText: qsTr("Insert")
|
buttonText: qsTr("Insert")
|
||||||
|
|
||||||
|
parentFlickable: fl
|
||||||
|
|
||||||
clickedFunc: function() {
|
clickedFunc: function() {
|
||||||
textField.text = ""
|
textField.text = ""
|
||||||
textField.paste()
|
textField.paste()
|
||||||
|
|
@ -169,14 +171,7 @@ PageType {
|
||||||
Layout.rightMargin: 16
|
Layout.rightMargin: 16
|
||||||
Layout.leftMargin: 16
|
Layout.leftMargin: 16
|
||||||
|
|
||||||
onFocusChanged: {
|
parentFlickable: fl
|
||||||
console.debug("MOVE THIS LOGIC TO CPP!")
|
|
||||||
if (activeFocus) {
|
|
||||||
if (fl) {
|
|
||||||
fl.ensureVisible(this)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
visible: textKey.textFieldText !== ""
|
visible: textKey.textFieldText !== ""
|
||||||
|
|
||||||
|
|
@ -214,14 +209,7 @@ PageType {
|
||||||
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
||||||
leftImageSource: "qrc:/images/controls/amnezia.svg"
|
leftImageSource: "qrc:/images/controls/amnezia.svg"
|
||||||
|
|
||||||
focusItem.onFocusChanged: {
|
parentFlickable: fl
|
||||||
console.debug("MOVE THIS LOGIC TO CPP!")
|
|
||||||
if (focusItem.activeFocus) {
|
|
||||||
if (fl) {
|
|
||||||
fl.ensureVisible(apiInstalling)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onClicked: function() {
|
onClicked: function() {
|
||||||
PageController.showBusyIndicator(true)
|
PageController.showBusyIndicator(true)
|
||||||
|
|
@ -247,14 +235,7 @@ PageType {
|
||||||
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
||||||
leftImageSource: "qrc:/images/controls/server.svg"
|
leftImageSource: "qrc:/images/controls/server.svg"
|
||||||
|
|
||||||
focusItem.onFocusChanged: {
|
parentFlickable: fl
|
||||||
console.debug("MOVE THIS LOGIC TO CPP!")
|
|
||||||
if (focusItem.activeFocus) {
|
|
||||||
if (fl) {
|
|
||||||
fl.ensureVisible(manualInstalling)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
PageController.goToPage(PageEnum.PageSetupWizardCredentials)
|
PageController.goToPage(PageEnum.PageSetupWizardCredentials)
|
||||||
|
|
@ -276,14 +257,7 @@ PageType {
|
||||||
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
||||||
leftImageSource: "qrc:/images/controls/archive-restore.svg"
|
leftImageSource: "qrc:/images/controls/archive-restore.svg"
|
||||||
|
|
||||||
focusItem.onFocusChanged: {
|
parentFlickable: fl
|
||||||
console.debug("MOVE THIS LOGIC TO CPP!")
|
|
||||||
if (focusItem.activeFocus) {
|
|
||||||
if (fl) {
|
|
||||||
fl.ensureVisible(backupRestore)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var filePath = SystemController.getFileName(qsTr("Open backup file"),
|
var filePath = SystemController.getFileName(qsTr("Open backup file"),
|
||||||
|
|
@ -309,12 +283,7 @@ PageType {
|
||||||
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
||||||
leftImageSource: "qrc:/images/controls/folder-search-2.svg"
|
leftImageSource: "qrc:/images/controls/folder-search-2.svg"
|
||||||
|
|
||||||
focusItem.onFocusChanged: {
|
parentFlickable: fl
|
||||||
console.debug("MOVE THIS LOGIC TO CPP!")
|
|
||||||
if (fl) {
|
|
||||||
fl.ensureVisible(openFile)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var nameFilter = !ServersModel.getServersCount() ? "Config or backup files (*.vpn *.ovpn *.conf *.json *.backup)" :
|
var nameFilter = !ServersModel.getServersCount() ? "Config or backup files (*.vpn *.ovpn *.conf *.json *.backup)" :
|
||||||
|
|
@ -343,14 +312,7 @@ PageType {
|
||||||
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
||||||
leftImageSource: "qrc:/images/controls/scan-line.svg"
|
leftImageSource: "qrc:/images/controls/scan-line.svg"
|
||||||
|
|
||||||
focusItem.onFocusChanged: {
|
parentFlickable: fl
|
||||||
console.debug("MOVE THIS LOGIC TO CPP!")
|
|
||||||
if (focusItem.activeFocus) {
|
|
||||||
if (fl) {
|
|
||||||
fl.ensureVisible(scanQr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
ImportController.startDecodingQr()
|
ImportController.startDecodingQr()
|
||||||
|
|
@ -375,14 +337,7 @@ PageType {
|
||||||
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
||||||
leftImageSource: "qrc:/images/controls/help-circle.svg"
|
leftImageSource: "qrc:/images/controls/help-circle.svg"
|
||||||
|
|
||||||
focusItem.onFocusChanged: {
|
parentFlickable: fl
|
||||||
console.debug("MOVE THIS LOGIC TO CPP!")
|
|
||||||
if (focusItem.activeFocus) {
|
|
||||||
if (fl) {
|
|
||||||
fl.ensureVisible(siteLink)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Qt.openUrlExternally(LanguageModel.getCurrentSiteUrl())
|
Qt.openUrlExternally(LanguageModel.getCurrentSiteUrl())
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,6 @@ import "../Controls2/TextTypes"
|
||||||
PageType {
|
PageType {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
// defaultActiveFocusItem: hostname.textField
|
|
||||||
|
|
||||||
BackButtonType {
|
BackButtonType {
|
||||||
id: backButton
|
id: backButton
|
||||||
|
|
||||||
|
|
@ -54,6 +52,8 @@ PageType {
|
||||||
headerText: qsTr("Server IP address [:port]")
|
headerText: qsTr("Server IP address [:port]")
|
||||||
textFieldPlaceholderText: qsTr("255.255.255.255:22")
|
textFieldPlaceholderText: qsTr("255.255.255.255:22")
|
||||||
|
|
||||||
|
parentFlickable: fl
|
||||||
|
|
||||||
textField.onFocusChanged: {
|
textField.onFocusChanged: {
|
||||||
textField.text = textField.text.replace(/^\s+|\s+$/g, '')
|
textField.text = textField.text.replace(/^\s+|\s+$/g, '')
|
||||||
}
|
}
|
||||||
|
|
@ -66,6 +66,8 @@ PageType {
|
||||||
headerText: qsTr("SSH Username")
|
headerText: qsTr("SSH Username")
|
||||||
textFieldPlaceholderText: "root"
|
textFieldPlaceholderText: "root"
|
||||||
|
|
||||||
|
parentFlickable: fl
|
||||||
|
|
||||||
textField.onFocusChanged: {
|
textField.onFocusChanged: {
|
||||||
textField.text = textField.text.replace(/^\s+|\s+$/g, '')
|
textField.text = textField.text.replace(/^\s+|\s+$/g, '')
|
||||||
}
|
}
|
||||||
|
|
@ -82,6 +84,8 @@ PageType {
|
||||||
buttonImageSource: textFieldText !== "" ? (hidePassword ? "qrc:/images/controls/eye.svg" : "qrc:/images/controls/eye-off.svg")
|
buttonImageSource: textFieldText !== "" ? (hidePassword ? "qrc:/images/controls/eye.svg" : "qrc:/images/controls/eye-off.svg")
|
||||||
: ""
|
: ""
|
||||||
|
|
||||||
|
parentFlickable: fl
|
||||||
|
|
||||||
clickedFunc: function() {
|
clickedFunc: function() {
|
||||||
hidePassword = !hidePassword
|
hidePassword = !hidePassword
|
||||||
}
|
}
|
||||||
|
|
@ -99,6 +103,8 @@ PageType {
|
||||||
|
|
||||||
text: qsTr("Continue")
|
text: qsTr("Continue")
|
||||||
|
|
||||||
|
parentFlickable: fl
|
||||||
|
|
||||||
clickedFunc: function() {
|
clickedFunc: function() {
|
||||||
forceActiveFocus()
|
forceActiveFocus()
|
||||||
if (!isCredentialsFilled()) {
|
if (!isCredentialsFilled()) {
|
||||||
|
|
@ -138,6 +144,8 @@ PageType {
|
||||||
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
rightImageSource: "qrc:/images/controls/chevron-right.svg"
|
||||||
leftImageSource: "qrc:/images/controls/help-circle.svg"
|
leftImageSource: "qrc:/images/controls/help-circle.svg"
|
||||||
|
|
||||||
|
parentFlickable: fl
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Qt.openUrlExternally(LanguageModel.getCurrentSiteUrl() + "/starter-guide")
|
Qt.openUrlExternally(LanguageModel.getCurrentSiteUrl() + "/starter-guide")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,8 @@ PageType {
|
||||||
|
|
||||||
text: showContent ? qsTr("Collapse content") : qsTr("Show content")
|
text: showContent ? qsTr("Collapse content") : qsTr("Show content")
|
||||||
|
|
||||||
|
parentFlickable: fl
|
||||||
|
|
||||||
clickedFunc: function() {
|
clickedFunc: function() {
|
||||||
showContent = !showContent
|
showContent = !showContent
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,16 +90,6 @@ PageType {
|
||||||
PageController.closePage()
|
PageController.closePage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// function onForceTabBarActiveFocus() {
|
|
||||||
// homeTabButton.focus = true
|
|
||||||
// tabBar.forceActiveFocus()
|
|
||||||
// }
|
|
||||||
|
|
||||||
// function onForceStackActiveFocus() {
|
|
||||||
// homeTabButton.focus = true
|
|
||||||
// tabBarStackView.forceActiveFocus()
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
|
|
@ -311,10 +301,6 @@ PageType {
|
||||||
tabBar.currentIndex = 0
|
tabBar.currentIndex = 0
|
||||||
FocusController.setRootItem(null) // TODO: move to do it automaticaly
|
FocusController.setRootItem(null) // TODO: move to do it automaticaly
|
||||||
}
|
}
|
||||||
|
|
||||||
// KeyNavigation.tab: shareTabButton
|
|
||||||
// Keys.onEnterPressed: this.clicked()
|
|
||||||
// Keys.onReturnPressed: this.clicked()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TabImageButtonType {
|
TabImageButtonType {
|
||||||
|
|
@ -340,8 +326,6 @@ PageType {
|
||||||
tabBarStackView.goToTabBarPage(PageEnum.PageShare)
|
tabBarStackView.goToTabBarPage(PageEnum.PageShare)
|
||||||
tabBar.currentIndex = 1
|
tabBar.currentIndex = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// KeyNavigation.tab: settingsTabButton
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TabImageButtonType {
|
TabImageButtonType {
|
||||||
|
|
@ -354,8 +338,6 @@ PageType {
|
||||||
tabBarStackView.goToTabBarPage(PageEnum.PageSettings)
|
tabBarStackView.goToTabBarPage(PageEnum.PageSettings)
|
||||||
tabBar.currentIndex = 2
|
tabBar.currentIndex = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
// KeyNavigation.tab: plusTabButton
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TabImageButtonType {
|
TabImageButtonType {
|
||||||
|
|
@ -368,8 +350,6 @@ PageType {
|
||||||
tabBarStackView.goToTabBarPage(PageEnum.PageSetupWizardConfigSource)
|
tabBarStackView.goToTabBarPage(PageEnum.PageSetupWizardConfigSource)
|
||||||
tabBar.currentIndex = 3
|
tabBar.currentIndex = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keys.onTabPressed: PageController.forceStackActiveFocus()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue