Commit 7456e9a5 authored by Exc404's avatar Exc404

Кнопка Play + LB, RB кнопки

parent bc7d82d8
...@@ -13,7 +13,7 @@ Rectangle { ...@@ -13,7 +13,7 @@ Rectangle {
property var activeButtonTab: buttonGames property var activeButtonTab: buttonGames
id: tabs id: tabs
x: 100 x: 0
y: 0 y: 0
anchors.fill: parent anchors.fill: parent
...@@ -42,138 +42,159 @@ Rectangle { ...@@ -42,138 +42,159 @@ Rectangle {
ColumnLayout{ ColumnLayout{
id:topNavigation id:topNavigation
width: parent.width width: parent.width
RowLayout { Rectangle{
id: tabButtons width: parent.width
property int tempX: 100 height: buttonSystemManagement.height
property bool toggle: false color:"#00000000"
//anchors.leftMargin: parent.width / 10
//anchors.rightMargin: parent.width / 10
Component.onCompleted: {
tabButtons.changeButtonActiveTab(tabs.activeButtonTab);
tabButtons.x = tabButtons.tempX;
console.log("tabButtons completed!");
}
Layout.bottomMargin: buttonSystemManagement.height / 2 Layout.bottomMargin: buttonSystemManagement.height / 2
Layout.topMargin: buttonSystemManagement.height / 3 Layout.topMargin: buttonSystemManagement.height / 3
x:100
// Состояния Image {
states: [ id: iconLB
State { source: "../icons/XboxController/left-bumper.svg"
name: "ClickTabButton"; fillMode: Image.Tile
when: tabButtons.toggle; sourceSize.width: tabButtons.width / 100 * 15
PropertyChanges { //sourceSize.height:
target: tabButtons; //Layout.alignment: Qt.AlignLeft;
x:tempX anchors.leftMargin: window.width / 100 * 6
} anchors.left: parent.left
}, anchors.verticalCenter: tabButtons.verticalCenter
State { //Layout.leftMargin: Math.floor( parent.width / 100 * 6)
name: ""; }
when: 1 == 1
RowLayout {
id: tabButtons
property int tempX: 100
property bool toggle: false
Component.onCompleted: {
tabButtons.changeButtonActiveTab(tabs.activeButtonTab);
tabButtons.x = tabButtons.tempX;
console.log("tabButtons completed!");
} }
]
// Анимации при изменениях состояний
transitions: x:0
Transition { // Состояния
from: ""; states: [
to: "ClickTabButton"; State {
PropertyAnimation { name: "ClickTabButton";
id: clickTabButtonAnimation when: tabButtons.toggle;
// from: tempX PropertyChanges {
duration: 200 target: tabButtons;
property: "x" x:tempX
// анимацию можно будет поменять в любое время }
easing.type: Easing.InOutCirc },
State {
name: "";
when: 1 == 1
}
]
// Анимации при изменениях состояний
transitions:
Transition {
from: "";
to: "ClickTabButton";
PropertyAnimation {
id: clickTabButtonAnimation
// from: tempX
duration: 200
property: "x"
// анимацию можно будет поменять в любое время
easing.type: Easing.InOutCirc
}
} }
// Функция перемещения кнопок
// TODO: OPTIMIZE (REDUCE EXTRA FOR LOOP)
function changeButtonActiveTab(ButtonId){
let index = 0;
let left_distance = 0;
let i = 0;
for(i = 0; i < tabButtons.children.length; ++i) {
if (children[i] === ButtonId) {
index = i
break
}
}
for(i = 0; i < index; ++i) {
left_distance += spacing + children[i].width;
}
tempX = topNavigation.width / 2 - tabButtons.children[index].width / 2 - left_distance;
tabs.activeButtonTab.isActive = false;
tabs.activeButtonTab = ButtonId;
tabs.activeButtonTab.isActive = true;
} }
// Функция перемещения кнопок
// TODO: OPTIMIZE (REDUCE EXTRA FOR LOOP) TopMenuBut.TextButton {
function changeButtonActiveTab(ButtonId){ id: buttonSystemManagement;
let index = 0; text: TabConstants.systemManagementTab;
let left_distance = 0; width: 400;
let i = 0;
onClicked: function(){
for(i = 0; i < tabButtons.children.length; ++i) { tabButtons.x = tabButtons.tempX
if (children[i] === ButtonId) { tabButtons.changeButtonActiveTab(this)
index = i tabButtons.toggle = true
break tabs.currentTab = TabConstants.systemManagementTab;
// tabs.changeTab();
// console.log(tabs.urrentTab);
} }
onReleased: tabButtons.toggle = false
} }
TopMenuBut.TextButton {
id: buttonGames
text: TabConstants.gamesTab
onClicked: function(){
tabButtons.x = tabButtons.tempX
tabButtons.changeButtonActiveTab(this)
tabButtons.toggle = true
tabs.currentTab = TabConstants.gamesTab;
//if(core_app === undefined) return;
//console.log("core_app found");
//app.get_games();
// tabs.changeTab();
// ;console.log(tabs.currentTab);
// ;console.log("1");
}
onReleased: tabButtons.toggle = false
for(i = 0; i < index; ++i) {
left_distance += spacing + children[i].width;
} }
tempX = topNavigation.width / 2 - tabButtons.children[index].width / 2 - left_distance; TopMenuBut.TextButton {
tabs.activeButtonTab.isActive = false; id: testbut2
tabs.activeButtonTab = ButtonId; text: "Test"
tabs.activeButtonTab.isActive = true; //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
TopMenuBut.TextButton {
id: buttonSystemManagement;
text: TabConstants.systemManagementTab;
width: 400;
onClicked: function(){
tabButtons.x = tabButtons.tempX
tabButtons.changeButtonActiveTab(this)
tabButtons.toggle = true
tabs.currentTab = TabConstants.systemManagementTab;
// tabs.changeTab();
// console.log(tabs.urrentTab);
}
onReleased: tabButtons.toggle = false
}
TopMenuBut.TextButton {
id: buttonGames
text: TabConstants.gamesTab
onClicked: function(){
tabButtons.x = tabButtons.tempX
tabButtons.changeButtonActiveTab(this)
tabButtons.toggle = true
tabs.currentTab = TabConstants.gamesTab;
//if(core_app === undefined) return;
//console.log("core_app found");
//app.get_games();
// tabs.changeTab();
// ;console.log(tabs.currentTab);
// ;console.log("1");
} }
onReleased: tabButtons.toggle = false
} }
TopMenuBut.TextButton { Image {
id: testbut1 id: iconRB
text: "Mega" source: "../icons/XboxController/right-bumper.svg"
onClicked: function(){ fillMode: Image.Tile
tabButtons.x = tabButtons.tempX //sourceSize.width: text.font.pixelSize * 2
tabButtons.changeButtonActiveTab(this) //sourceSize.height: tabButtons.width / 10
tabButtons.toggle = true sourceSize.width: tabButtons.width / 100 * 15
} //Layout.alignment: Qt.AlignRight;
onReleased: tabButtons.toggle = false anchors.verticalCenter: tabButtons.verticalCenter
anchors.rightMargin: window.width / 100 * 6
} anchors.right: parent.right
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
} }
} }
} }
// Заглушка Системных настроек // Заглушка Системных настроек
Grid { Grid {
...@@ -253,6 +274,7 @@ Rectangle { ...@@ -253,6 +274,7 @@ Rectangle {
model: core_app.games model: core_app.games
// Карточка игры // Карточка игры
Game { Game {
id: game
gameTitle: model.name gameTitle: model.name
gameExec: model.exec gameExec: model.exec
gameIcon: model.icon gameIcon: model.icon
...@@ -267,6 +289,40 @@ Rectangle { ...@@ -267,6 +289,40 @@ Rectangle {
gamesGrid.rowSpacing - gamesGrid.anchors.rightMargin - gamesGrid.anchors.leftMargin) gamesGrid.rowSpacing - gamesGrid.anchors.rightMargin - gamesGrid.anchors.leftMargin)
/ gamesGrid.columns / gamesGrid.columns
Layout.preferredHeight: Layout.preferredWidth / 2 * 3 Layout.preferredHeight: Layout.preferredWidth / 2 * 3
// Component.onCompleted: {a3.start()}
// SequentialAnimation {
// id:a3
// NumberAnimation {
// property:Layout.topMargin;
// easing.type: Easing.InOutQuad;
// duration: 300;
// from: 100//Layout.preferredHeight;
// to: 0;
// }
// NumberAnimation {
// property:Layout.topMargin;
// easing.type: Easing.InOutQuad;
// duration: 300;
// from: 0//Layout.preferredHeight;
// to: 100;
// }
// loops: Animation.Infinite
// }
//Layout.topMargin: Layout.preferredHeight
} }
} }
} }
......
...@@ -19,7 +19,7 @@ C.Button { ...@@ -19,7 +19,7 @@ C.Button {
font.family: globalFont.font font.family: globalFont.font
font.weight: 400 font.weight: 400
font.styleName: globalFont.font.styleName font.styleName: globalFont.font.styleName
font.pointSize: 14 font.pointSize: 16
//font.bold : true //font.bold : true
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
......
...@@ -31,9 +31,6 @@ Rectangle { ...@@ -31,9 +31,6 @@ Rectangle {
gameRect.anchors.left = startPos.left gameRect.anchors.left = startPos.left
gameRect.anchors.top = startPos.top gameRect.anchors.top = startPos.top
runGameButton.focus = true runGameButton.focus = true
// gameRect.width = startPos.Layout.preferredWidth
// gameRect.Height = startPos.Layout.preferredHeight
root.state = "completed" root.state = "completed"
} }
states:[ states:[
...@@ -67,7 +64,6 @@ Rectangle { ...@@ -67,7 +64,6 @@ Rectangle {
] ]
transitions: Transition { transitions: Transition {
// smoothly reanchor myRect and move into new position
AnchorAnimation { duration: 300 } AnchorAnimation { duration: 300 }
} }
...@@ -190,8 +186,8 @@ Rectangle { ...@@ -190,8 +186,8 @@ Rectangle {
anchors.top: gameRect.parent.top anchors.top: gameRect.parent.top
anchors.leftMargin: root.width / 100 * 3 anchors.leftMargin: root.width / 100 * 3
anchors.topMargin: root.width / 100 * 3 anchors.topMargin: root.width / 100 * 3
width:root.width / 100 * 20 width: height /3 * 2 //root.width / 100 * 20
height: width / 2 * 3 height: root.height / 2 //width / 2 * 3
color:"#00000000" color:"#00000000"
} }
...@@ -226,13 +222,9 @@ Rectangle { ...@@ -226,13 +222,9 @@ Rectangle {
RowLayout{ RowLayout{
id:info id:info
width: parent.width - finishPos.width - root.width / 100 * 6 width: parent.width - finishPos.width - root.width / 100 * 6
//height: content.height - topPanel.height
anchors.left: finishPos.right anchors.left: finishPos.right
anchors.top: finishPos.top anchors.top: finishPos.top
anchors.leftMargin: root.width / 100 * 3 anchors.leftMargin: root.width / 100 * 3
ColumnLayout{ ColumnLayout{
Layout.alignment: Qt.AlignLeft | Qt.AlignTop Layout.alignment: Qt.AlignLeft | Qt.AlignTop
Layout.fillWidth: true Layout.fillWidth: true
...@@ -240,45 +232,119 @@ Rectangle { ...@@ -240,45 +232,119 @@ Rectangle {
spacing: 40 spacing: 40
Text { Text {
id: title id: title
//width: root.width / 100 * 10
Layout.maximumWidth: root.width / 100 * 30 Layout.maximumWidth: root.width / 100 * 30
font.weight: 600 font.weight: 600
wrapMode: Text.Wrap wrapMode: Text.Wrap
text: root.title text: root.title
//font.pixelSize: 32
font.pixelSize:Math.max(19,root.height / 100 * 4.2) font.pixelSize:Math.max(19,root.height / 100 * 4.2)
color: "white" color: "white"
} }
Button { Button {
id: runGameButton id: runGameButton
text: "Run game"
focus: true focus: true
//background.opacity: 0.2
leftPadding: textGame.font.pixelSize * 3
rightPadding: leftPadding
topPadding: leftPadding/ 8
bottomPadding: leftPadding/8
//opacity: 0.8
text:"Play"
width: textGame.contentWidth + 5
hoverEnabled: true
contentItem: Text {
id: textGame
text: runGameButton.text
font.pixelSize:Math.max(19,root.height / 100 * 3)
font.family: globalFont.font
font.weight: 800
font.styleName: globalFont.font.styleName
color: 'white'
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
padding:10
background: Rectangle {
id:runGameBg
color: "white" //control.down ? "#aaaaaa" : (control.activeFocus ? "#aaaaaa" : "#000000")
opacity: 0.1
radius: runGameButton.width * 0.3
}
onClicked: function(){ onClicked: function(){
if(window.scene !== S.gameInfoScene) return; if(window.scene !== S.gameInfoScene) return;
if(core_app === undefined) return; if(core_app === undefined) return;
core_app.start_game(root.exec); core_app.start_game(root.exec);
} }
// Состояния
states: [
// Карточка в фокуске
State {
name: "focus"; when: runGameButton.activeFocus
PropertyChanges {
target: runGameBg;
opacity: 1;
}
PropertyChanges {
target: textGame;
font.weight: 800;
color:"black"
}
},
// На карточку навели курсор мыши
State {
name: "hover"; when: runGameButton.hovered
PropertyChanges {
target: runGameBg;
opacity: 1;
}
PropertyChanges {
target: textGame;
color:"black"
}
}
]
// Анимации при изменениях состояний
transitions: Transition {
reversible: true
NumberAnimation {
property: "opacity";
duration: 300
}
}
} }
} }
Text {
//anchors.top: info.top
// anchors.right: info.right
horizontalAlignment: Text.AlignJustif
Layout.alignment:Qt.AlignRight| Qt.AlignTop
//Layout.preferredWidth:
Text {
horizontalAlignment: Text.AlignJustif
Layout.alignment:Qt.AlignRight| Qt.AlignTop
id: title2 id: title2
//width: root.width / 100 * 10
Layout.maximumWidth: root.width / 100 * 30 Layout.maximumWidth: root.width / 100 * 30
Layout.maximumHeight: root.height / 100 * 70 Layout.maximumHeight: root.height / 100 * 70
elide: Text.ElideRight elide: Text.ElideRight
wrapMode: Text.Wrap wrapMode: Text.Wrap
text: "SD ferwf f wqefewf wekj fn wfaksljf dskvjblds vdfkjvb dvlkdfsj vd vjdfk vkldfjv dfkl vd vfkjlbdf kdfljb fkdjn kdjf vd kdfjv vdfkvjdv dfvjkf vdfv SD ferwf f wqefewf wekj fn wfaksljf dskvjblds vdfkjvb dvlkdfsj vd vjdfk vkldfjv dfkl vd vfkjlbdf kdfljb fkdjn kdjf vd kdfjv vdfkvjdv dfvjkf vdfv SD ferwf f wqefewf wekj fn wfaksljf dskvjblds vdfkjvb dvlkdfsj vd vjdfk vkldfjv dfkl vd vfkjlbdf kdfljb fkdjn kdjf vd kdfjv vdfkvjdv dfvjkf vdfv SD ferwf f wqefewf wekj fn wfaksljf dskvjblds vdfkjvb dvlkdfsj vd vjdfk vkldfjv dfkl vd vfkjlbdf kdfljb fkdjn kdjf vd kdfjv vdfkvjdv dfvjkf vdfvSD ferwf f wqefewf wekj fn wfaksljf dskvjblds vdfkjvb dvlkdfsj vd vjdfk vkldfjv dfkl vd vfkjlbdf kdfljb fkdjn kdjf vd kdfjv vdfkvjdv dfvjkf vdfv SD ferwf f wqefewf wekj fn wfaksljf dskvjblds vdfkjvb dvlkdfsj vd vjdfk vkldfjv dfkl vd vfkjlbdf kdfljb fkdjn kdjf vd kdfjv vdfkvjdv dfvjkf vdfvSD ferwf f wqefewf wekj fn wfaksljf dskvjblds vdfkjvb dvlkdfsj vd vjdfk vkldfjv dfkl vd vfkjlbdf kdfljb fkdjn kdjf vd kdfjv vdfkvjdv dfvjkf vdfv SD ferwf f wqefewf wekj fn wfaksljf dskvjblds vdfkjvb dvlkdfsj vd vjdfk vkldfjv dfkl vd vfkjlbdf kdfljb fkdjn kdjf vd kdfjv vdfkvjdv dfvjkf vdfv " text: "SD ferwf f wqefewf wekj fn wfaksljf dskvjblds vdfkjvb dvlkdfsj vd vjdfk vkldfjv dfkl vd vfkjlbdf kdfljb fkdjn kdjf vd kdfjv vdfkvjdv dfvjkf vdfv SD ferwf f wqefewf wekj fn wfaksljf dskvjblds vdfkjvb dvlkdfsj vd vjdfk vkldfjv dfkl vd vfkjlbdf kdfljb fkdjn kdjf vd kdfjv vdfkvjdv dfvjkf vdfv SD ferwf f wqefewf wekj fn wfaksljf dskvjblds vdfkjvb dvlkdfsj vd vjdfk vkldfjv dfkl vd vfkjlbdf kdfljb fkdjn kdjf vd kdfjv vdfkvjdv dfvjkf vdfv SD ferwf f wqefewf wekj fn wfaksljf dskvjblds vdfkjvb dvlkdfsj vd vjdfk vkldfjv dfkl vd vfkjlbdf kdfljb fkdjn kdjf vd kdfjv vdfkvjdv dfvjkf vdfvSD ferwf f wqefewf wekj fn wfaksljf dskvjblds vdfkjvb dvlkdfsj vd vjdfk vkldfjv dfkl vd vfkjlbdf kdfljb fkdjn kdjf vd kdfjv vdfkvjdv dfvjkf vdfv SD ferwf f wqefewf wekj fn wfaksljf dskvjblds vdfkjvb dvlkdfsj vd vjdfk vkldfjv dfkl vd vfkjlbdf kdfljb fkdjn kdjf vd kdfjv vdfkvjdv dfvjkf vdfvSD ferwf f wqefewf wekj fn wfaksljf dskvjblds vdfkjvb dvlkdfsj vd vjdfk vkldfjv dfkl vd vfkjlbdf kdfljb fkdjn kdjf vd kdfjv vdfkvjdv dfvjkf vdfv SD ferwf f wqefewf wekj fn wfaksljf dskvjblds vdfkjvb dvlkdfsj vd vjdfk vkldfjv dfkl vd vfkjlbdf kdfljb fkdjn kdjf vd kdfjv vdfkvjdv dfvjkf vdfv "
font.pixelSize:Math.max(13,root.height / 100 * 2.2) font.pixelSize:Math.max(13,root.height / 100 * 2.2)
...@@ -287,14 +353,8 @@ Rectangle { ...@@ -287,14 +353,8 @@ Rectangle {
} }
} }
} }
......
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