Commit f998d93a authored by Yankovskiy Georgiy's avatar Yankovskiy Georgiy

Merge resolve

parents 194a9181 4b5a7b32
...@@ -30,6 +30,8 @@ class App(QtCore.QObject): ...@@ -30,6 +30,8 @@ class App(QtCore.QObject):
gamepad_clicked_RB = Signal(bool, name="gamepadClickedRB") gamepad_clicked_RB = Signal(bool, name="gamepadClickedRB")
gamepad_clicked_apply = Signal(bool, name="gamepadClickedApply") gamepad_clicked_apply = Signal(bool, name="gamepadClickedApply")
gamepad_clicked_back = Signal(bool, name="gamepadClickedBack") gamepad_clicked_back = Signal(bool, name="gamepadClickedBack")
gamepad_axis_up = Signal(bool, name="gamepadAxisUp")
gamepad_axis_down = Signal(bool, name="gamepadAxisDown")
gamepad_axis_left = Signal(bool, name="gamepadAxisLeft") gamepad_axis_left = Signal(bool, name="gamepadAxisLeft")
gamepad_axis_right = Signal(bool, name="gamepadAxisRight") gamepad_axis_right = Signal(bool, name="gamepadAxisRight")
...@@ -50,6 +52,8 @@ class App(QtCore.QObject): ...@@ -50,6 +52,8 @@ class App(QtCore.QObject):
self.gamepad.apply_clicked = lambda: self.gamepad_clicked_apply.emit(True) self.gamepad.apply_clicked = lambda: self.gamepad_clicked_apply.emit(True)
self.gamepad.l_clicked = lambda: self.gamepad_axis_left.emit(True) self.gamepad.l_clicked = lambda: self.gamepad_axis_left.emit(True)
self.gamepad.r_clicked = lambda: self.gamepad_axis_right.emit(True) self.gamepad.r_clicked = lambda: self.gamepad_axis_right.emit(True)
self.gamepad.u_clicked = lambda: self.gamepad_axis_up.emit(True)
self.gamepad.d_clicked = lambda: self.gamepad_axis_down.emit(True)
self.gamepad.back_clicked = lambda: self.gamepad_clicked_back.emit(True) self.gamepad.back_clicked = lambda: self.gamepad_clicked_back.emit(True)
self.agent = GameAgent(self.config_path, self.cache_path) self.agent = GameAgent(self.config_path, self.cache_path)
......
...@@ -11,6 +11,8 @@ class Gamepad: ...@@ -11,6 +11,8 @@ class Gamepad:
RB_BUTTON = 5 RB_BUTTON = 5
LEFT_RIGHT_AXIS = 0 LEFT_RIGHT_AXIS = 0
LEFT_RIGHT_AXIS_SENSITIVITY = 0.7 LEFT_RIGHT_AXIS_SENSITIVITY = 0.7
UP_DOWN_AXIS = 1
UP_DOWN_AXIS_SENSITIVITY = 0.7
APPLY_BUTTON = 0 APPLY_BUTTON = 0
BACK_BUTTON = 1 BACK_BUTTON = 1
...@@ -23,12 +25,16 @@ class Gamepad: ...@@ -23,12 +25,16 @@ class Gamepad:
self.last_apply_clicked: bool = False self.last_apply_clicked: bool = False
self.last_left_clicked: bool = False self.last_left_clicked: bool = False
self.last_right_clicked: bool = False self.last_right_clicked: bool = False
self.last_up_clicked: bool = False
self.last_down_clicked: bool = False
self.last_back_clicked: bool = False self.last_back_clicked: bool = False
self.lb_clicked: () = lambda: None self.lb_clicked: () = lambda: None
self.rb_clicked: () = lambda: None self.rb_clicked: () = lambda: None
self.l_clicked: () = lambda: None self.l_clicked: () = lambda: None
self.r_clicked: () = lambda: None self.r_clicked: () = lambda: None
self.u_clicked: () = lambda: None
self.d_clicked: () = lambda: None
self.back_clicked: () = lambda: None self.back_clicked: () = lambda: None
self.apply_clicked: () = lambda: None self.apply_clicked: () = lambda: None
...@@ -64,6 +70,7 @@ class Gamepad: ...@@ -64,6 +70,7 @@ class Gamepad:
rb_button = self.joystick.get_button(self.RB_BUTTON) rb_button = self.joystick.get_button(self.RB_BUTTON)
apply_button = self.joystick.get_button(self.APPLY_BUTTON) apply_button = self.joystick.get_button(self.APPLY_BUTTON)
left_right_axis = self.joystick.get_axis(self.LEFT_RIGHT_AXIS) left_right_axis = self.joystick.get_axis(self.LEFT_RIGHT_AXIS)
up_down_axis = self.joystick.get_axis(self.UP_DOWN_AXIS)
back_button = self.joystick.get_button(self.BACK_BUTTON) back_button = self.joystick.get_button(self.BACK_BUTTON)
# LB # LB
...@@ -110,6 +117,23 @@ class Gamepad: ...@@ -110,6 +117,23 @@ class Gamepad:
if (not left_right_axis >= self.LEFT_RIGHT_AXIS_SENSITIVITY) and self.last_right_clicked: if (not left_right_axis >= self.LEFT_RIGHT_AXIS_SENSITIVITY) and self.last_right_clicked:
self.last_right_clicked = not self.last_right_clicked self.last_right_clicked = not self.last_right_clicked
# UP
if (up_down_axis <= -self.UP_DOWN_AXIS_SENSITIVITY) and not self.last_up_clicked:
self.last_up_clicked = not self.last_up_clicked
self.u_clicked()
if not (up_down_axis <= -self.UP_DOWN_AXIS_SENSITIVITY) and self.last_up_clicked:
self.last_up_clicked = not self.last_up_clicked
# DOWN
if (up_down_axis >= self.UP_DOWN_AXIS_SENSITIVITY) and not self.last_down_clicked:
self.last_down_clicked = not self.last_down_clicked
self.d_clicked()
if (not up_down_axis >= self.UP_DOWN_AXIS_SENSITIVITY) and self.last_down_clicked:
self.last_down_clicked = not self.last_down_clicked
# BACK # BACK
if back_button and not self.last_back_clicked: if back_button and not self.last_back_clicked:
self.last_back_clicked = not self.last_back_clicked self.last_back_clicked = not self.last_back_clicked
......
...@@ -135,16 +135,12 @@ Rectangle { ...@@ -135,16 +135,12 @@ Rectangle {
id: buttonSystemManagement; id: buttonSystemManagement;
text: TabConstants.systemManagementTab; text: TabConstants.systemManagementTab;
width: 400; width: 400;
/*
onClicked: function(){ onClicked: function(){
tabButtons.x = tabButtons.tempX tabButtons.x = tabButtons.tempX
tabButtons.changeButtonActiveTab(this) tabButtons.changeButtonActiveTab(this)
tabButtons.toggle = true tabButtons.toggle = true
tabs.currentTab = TabConstants.systemManagementTab; tabs.currentTab = TabConstants.systemManagementTab;
// tabs.changeTab();
console.log(tabs.currentTab);
} }
*/
onReleased: tabButtons.toggle = false onReleased: tabButtons.toggle = false
} }
TopMenuBut.TextButton { TopMenuBut.TextButton {
...@@ -168,6 +164,20 @@ Rectangle { ...@@ -168,6 +164,20 @@ Rectangle {
} }
TopMenuBut.TextButton {
id: testbut2
text: "Test"
//font.pixelSize: 60
//height:Math.ceil(tabs.height/100 * 10)
onClicked: function(){
tabButtons.x = tabButtons.tempX
tabButtons.changeButtonActiveTab(this)
tabButtons.toggle = true
}
onReleased: tabButtons.toggle = false
}
} }
Image { Image {
...@@ -186,78 +196,47 @@ Rectangle { ...@@ -186,78 +196,47 @@ Rectangle {
} }
} }
// Заглушка Системных настроек !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // Заглушка Системных настроек
Grid { Grid {
id: systemManagementGrid id: systemManagementGrid
visible: tabs.currentTab == TabConstants.systemManagementTab visible: tabs.currentTab == TabConstants.systemManagementTab
columns: 1 columns: 3
spacing: 2 spacing: 2
anchors.centerIn: parent
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
Layout.topMargin: 190 Layout.topMargin: 190
// anchors.rightMargin: 0
// anchors.leftMargin: 0
// anchors.bottomMargin: 90
anchors.rightMargin: 0 anchors.rightMargin: 0
anchors.leftMargin: 0 anchors.leftMargin: 0
anchors.bottomMargin : 90 anchors.bottomMargin: 90
Row { Rectangle {
Text { color: "red";
font.family: globalFont.font width: 50;
font.weight: 400 height: 50;
font.styleName: globalFont.font.styleName
font.pointSize: 16
text: "Полный экран при запуске:"
color: 'white'
opacity: 0.8
}
CheckBox {
onCheckedChanged: {
if (checked) {
window.visibility = Window.FullScreen
} else {
window.visibility = Window.Windowed
}
}
}
}
Row {
Text {
font.family: globalFont.font
font.weight: 400
font.styleName: globalFont.font.styleName
font.pointSize: 16
color: 'white'
opacity: 0.8
text: "Каталог PortProton"
}
TextField {
id: pathTextField
width: 150
readOnly: true
text: "Выберите каталог"
} }
Button { Rectangle {
width: 50 color: "green";
text: "Выбрать" width: 20;
onClicked: fileDialog.open() height: 50;
} }
Rectangle {
color: "blue";
width: 50;
height: 20;
} }
FileDialog { Rectangle {
id: fileDialog color: "cyan";
title: "Выберите каталог" width: 50;
currentFolder: "/" height: 50;
fileMode: FileDialog.Directory
onAccepted: {
pathTextField.text = fileDialog.currentFolder
} }
Rectangle {
color: "magenta";
width: 10;
height: 10;
} }
} }
...@@ -312,7 +291,6 @@ Rectangle { ...@@ -312,7 +291,6 @@ Rectangle {
// Повторитель // Повторитель
Repeater { Repeater {
id: gamesGridRepeater
model: core_app.games model: core_app.games
// Карточка игры // Карточка игры
Game { Game {
...@@ -366,7 +344,6 @@ Rectangle { ...@@ -366,7 +344,6 @@ Rectangle {
// LOGIC // LOGIC
property int focusedItems: 0; property int focusedItems: 0;
property int focusedTabs: 0; property int focusedTabs: 0;
...@@ -401,14 +378,17 @@ Rectangle { ...@@ -401,14 +378,17 @@ Rectangle {
if(window.scene !== S.homeScene) return; if(window.scene !== S.homeScene) return;
let c = gamesGrid.children; let c = gamesGrid.children;
let l = c.length - 1; // exclude QQuickRepeater
tabs.focusedItems += inc; // console.log(tabs.focusedItems);
if(tabs.focusedItems >= c.length)
tabs.focusedItems = 0;
if(tabs.focusedItems < 0)
tabs.focusedItems = c.length - 1;
if(tabs.focusedItems + inc >= l) {
tabs.focusedItems = (c.focusedItems + inc === l - 1) ? 0 : l - 1;
} else if(tabs.focusedItems + inc < 0) {
tabs.focusedItems = (c.focusedItems + inc === 0) ? l - 1 : 0; //;
} else {
tabs.focusedItems += inc;
}
c[tabs.focusedItems].forceActiveFocus(); c[tabs.focusedItems].forceActiveFocus();
// gamesScroller.contentY = c[tabs.focusedItems].y; // not working // gamesScroller.contentY = c[tabs.focusedItems].y; // not working
// c[tabs.focusedItems].clicked(); // c[tabs.focusedItems].clicked();
...@@ -422,7 +402,14 @@ Rectangle { ...@@ -422,7 +402,14 @@ Rectangle {
function onGamepadClickedRB(args){ function onGamepadClickedRB(args){
tabs.applyTabsFocus(1) tabs.applyTabsFocus(1)
} }
function onGamepadAxisLeft(args){
function onGamepadAxisUp(done){
tabs.applyItemsFocus(-gamesGrid.columns);
}
function onGamepadAxisDown(done){
tabs.applyItemsFocus(gamesGrid.columns);
}
function onGamepadAxisLeft(done){
tabs.applyItemsFocus(-1) tabs.applyItemsFocus(-1)
} }
function onGamepadAxisRight(args){ function onGamepadAxisRight(args){
......
...@@ -46,6 +46,12 @@ Window { ...@@ -46,6 +46,12 @@ Window {
function onGamepadAxisRight(done){ function onGamepadAxisRight(done){
window._trigger("onGamepadAxisRight", done); window._trigger("onGamepadAxisRight", done);
} }
function onGamepadAxisUp(done){
window._trigger("onGamepadAxisUp", done);
}
function onGamepadAxisDown(done){
window._trigger("onGamepadAxisDown", done);
}
function onGamepadClickedApply(done){ function onGamepadClickedApply(done){
window._trigger("onGamepadClickedApply", done); window._trigger("onGamepadClickedApply", done);
} }
...@@ -65,6 +71,8 @@ Window { ...@@ -65,6 +71,8 @@ Window {
let d = scenes[scene]; let d = scenes[scene];
// console.log("CALLUP " + _method);
if(d !== null && d[_method] !== undefined && d[_method] !== null) if(d !== null && d[_method] !== undefined && d[_method] !== null)
d[_method](args); d[_method](args);
} }
......
...@@ -95,7 +95,7 @@ Rectangle { ...@@ -95,7 +95,7 @@ Rectangle {
} }
ColumnLayout{ ColumnLayout {
// anchors.fill:parent // anchors.fill:parent
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
...@@ -107,7 +107,7 @@ Rectangle { ...@@ -107,7 +107,7 @@ Rectangle {
anchors.topMargin: parent.height / 100 * 3 anchors.topMargin: parent.height / 100 * 3
spacing: 6 spacing: 6
ItemGroup{ ItemGroup {
id: topPanel id: topPanel
Button { Button {
id: back id: back
...@@ -178,7 +178,7 @@ Rectangle { ...@@ -178,7 +178,7 @@ Rectangle {
} }
} }
} }
Rectangle{ Rectangle {
// Start pos // Start pos
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
...@@ -390,6 +390,13 @@ Rectangle { ...@@ -390,6 +390,13 @@ Rectangle {
description.text = "Наименование игры:\n" + result['title'] + "\n\nОписание игры:\n" + result['desc'] description.text = "Наименование игры:\n" + result['title'] + "\n\nОписание игры:\n" + result['desc']
} }
function onGamepadAxisUp(done){
root.onGamepadAxisLeft(done);
}
function onGamepadAxisDown(done){
root.onGamepadAxisRight(done);
}
function onGamepadAxisLeft(done){ function onGamepadAxisLeft(done){
if(window.scene !== S.gameInfoScene) return; if(window.scene !== S.gameInfoScene) return;
root.applyItemsFocus(-1) root.applyItemsFocus(-1)
......
...@@ -11,6 +11,7 @@ Rectangle { ...@@ -11,6 +11,7 @@ Rectangle {
color: "#00000000" color: "#00000000"
onVisibleChanged: { onVisibleChanged: {
tabs.visible = container.visible; tabs.visible = container.visible;
} }
...@@ -59,5 +60,11 @@ Rectangle { ...@@ -59,5 +60,11 @@ Rectangle {
function onGameListDetailsRetrievingProgress(args){ function onGameListDetailsRetrievingProgress(args){
tabs.onGameListDetailsRetrievingProgress(args) tabs.onGameListDetailsRetrievingProgress(args)
} }
function onGamepadAxisUp(args){
tabs.onGamepadAxisUp(args)
}
function onGamepadAxisDown(args){
tabs.onGamepadAxisDown(args)
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment