Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
ingame
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav
ingame
Commits
7456e9a5
Commit
7456e9a5
authored
May 13, 2024
by
Exc404
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Кнопка Play + LB, RB кнопки
parent
bc7d82d8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
262 additions
and
146 deletions
+262
-146
Tabs.qml
qml/components/Tabs.qml
+172
-116
TextButton.qml
qml/components/TextButton.qml
+1
-1
GameInfoScene.qml
qml/scenes/GameInfoScene.qml
+89
-29
No files found.
qml/components/Tabs.qml
View file @
7456e9a5
...
...
@@ -13,7 +13,7 @@ Rectangle {
property
var
activeButtonTab
:
buttonGames
id
:
tabs
x
:
10
0
x
:
0
y
:
0
anchors.fill
:
parent
...
...
@@ -42,138 +42,159 @@ Rectangle {
ColumnLayout
{
id
:
topNavigation
width
:
parent
.
width
RowLayout
{
id
:
tabButtons
property
int
tempX
:
100
property
bool
toggle
:
false
//anchors.leftMargin: parent.width / 10
//anchors.rightMargin: parent.width / 10
Component.onCompleted
:
{
tabButtons
.
changeButtonActiveTab
(
tabs
.
activeButtonTab
);
tabButtons
.
x
=
tabButtons
.
tempX
;
console
.
log
(
"tabButtons completed!"
);
}
Rectangle
{
width
:
parent
.
width
height
:
buttonSystemManagement
.
height
color
:
"#00000000"
Layout.bottomMargin
:
buttonSystemManagement
.
height
/
2
Layout.topMargin
:
buttonSystemManagement
.
height
/
3
x
:
100
// Состояния
states
:
[
State
{
name
:
"ClickTabButton"
;
when
:
tabButtons
.
toggle
;
PropertyChanges
{
target
:
tabButtons
;
x
:
tempX
}
},
State
{
name
:
""
;
when
:
1
==
1
Image
{
id
:
iconLB
source
:
"../icons/XboxController/left-bumper.svg"
fillMode
:
Image
.
Tile
sourceSize.width
:
tabButtons
.
width
/
100
*
15
//sourceSize.height:
//Layout.alignment: Qt.AlignLeft;
anchors.leftMargin
:
window
.
width
/
100
*
6
anchors.left
:
parent
.
left
anchors.verticalCenter
:
tabButtons
.
verticalCenter
//Layout.leftMargin: Math.floor( parent.width / 100 * 6)
}
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
:
Transition
{
from
:
""
;
to
:
"ClickTabButton"
;
PropertyAnimation
{
id
:
clickTabButtonAnimation
// from: tempX
duration
:
200
property
:
"x"
// анимацию можно будет поменять в любое время
easing.type
:
Easing
.
InOutCirc
x
:
0
// Состояния
states
:
[
State
{
name
:
"ClickTabButton"
;
when
:
tabButtons
.
toggle
;
PropertyChanges
{
target
:
tabButtons
;
x
:
tempX
}
},
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)
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
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
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
;
}
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
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
{
id
:
testbut1
text
:
"Mega"
onClicked
:
function
(){
tabButtons
.
x
=
tabButtons
.
tempX
tabButtons
.
changeButtonActiveTab
(
this
)
tabButtons
.
toggle
=
true
}
onReleased
:
tabButtons
.
toggle
=
false
}
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
{
id
:
iconRB
source
:
"../icons/XboxController/right-bumper.svg"
fillMode
:
Image
.
Tile
//sourceSize.width: text.font.pixelSize * 2
//sourceSize.height: tabButtons.width / 10
sourceSize.width
:
tabButtons
.
width
/
100
*
15
//Layout.alignment: Qt.AlignRight;
anchors.verticalCenter
:
tabButtons
.
verticalCenter
anchors.rightMargin
:
window
.
width
/
100
*
6
anchors.right
:
parent
.
right
}
}
}
// Заглушка Системных настроек
Grid
{
...
...
@@ -253,6 +274,7 @@ Rectangle {
model
:
core_app
.
games
// Карточка игры
Game
{
id
:
game
gameTitle
:
model
.
name
gameExec
:
model
.
exec
gameIcon
:
model
.
icon
...
...
@@ -267,6 +289,40 @@ Rectangle {
gamesGrid
.
rowSpacing
-
gamesGrid
.
anchors
.
rightMargin
-
gamesGrid
.
anchors
.
leftMargin
)
/
gamesGrid
.
columns
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
}
}
}
...
...
qml/components/TextButton.qml
View file @
7456e9a5
...
...
@@ -19,7 +19,7 @@ C.Button {
font.family
:
globalFont
.
font
font.weight
:
400
font.styleName
:
globalFont
.
font
.
styleName
font.pointSize
:
1
4
font.pointSize
:
1
6
//font.bold : true
horizontalAlignment
:
Text
.
AlignHCenter
verticalAlignment
:
Text
.
AlignVCenter
...
...
qml/scenes/GameInfoScene.qml
View file @
7456e9a5
...
...
@@ -31,9 +31,6 @@ Rectangle {
gameRect
.
anchors
.
left
=
startPos
.
left
gameRect
.
anchors
.
top
=
startPos
.
top
runGameButton
.
focus
=
true
// gameRect.width = startPos.Layout.preferredWidth
// gameRect.Height = startPos.Layout.preferredHeight
root
.
state
=
"completed"
}
states
:[
...
...
@@ -67,7 +64,6 @@ Rectangle {
]
transitions
:
Transition
{
// smoothly reanchor myRect and move into new position
AnchorAnimation
{
duration
:
300
}
}
...
...
@@ -190,8 +186,8 @@ Rectangle {
anchors.top
:
gameRect
.
parent
.
top
anchors.leftMargin
:
root
.
width
/
100
*
3
anchors.topMargin
:
root
.
width
/
100
*
3
width
:
root
.
width
/
100
*
20
height
:
width
/
2
*
3
width
:
height
/
3
*
2
//
root.width / 100 * 20
height
:
root
.
height
/
2
//
width / 2 * 3
color
:
"#00000000"
}
...
...
@@ -226,13 +222,9 @@ Rectangle {
RowLayout
{
id
:
info
width
:
parent
.
width
-
finishPos
.
width
-
root
.
width
/
100
*
6
//height: content.height - topPanel.height
anchors.left
:
finishPos
.
right
anchors.top
:
finishPos
.
top
anchors.leftMargin
:
root
.
width
/
100
*
3
ColumnLayout
{
Layout.alignment
:
Qt
.
AlignLeft
|
Qt
.
AlignTop
Layout.fillWidth
:
true
...
...
@@ -240,45 +232,119 @@ Rectangle {
spacing
:
40
Text
{
id
:
title
//width: root.width / 100 * 10
Layout.maximumWidth
:
root
.
width
/
100
*
30
font.weight
:
600
wrapMode
:
Text
.
Wrap
text
:
root
.
title
//font.pixelSize: 32
font.pixelSize
:
Math
.
max
(
19
,
root
.
height
/
100
*
4.2
)
color
:
"white"
}
Button
{
id
:
runGameButton
text
:
"Run game"
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
(){
if
(
window
.
scene
!==
S
.
gameInfoScene
)
return
;
if
(
core_app
===
undefined
)
return
;
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
//width: root.width / 100 * 10
Layout.maximumWidth
:
root
.
width
/
100
*
30
Layout.maximumHeight
:
root
.
height
/
100
*
70
elide
:
Text
.
ElideRight
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 "
font.pixelSize
:
Math
.
max
(
13
,
root
.
height
/
100
*
2.2
)
...
...
@@ -287,14 +353,8 @@ Rectangle {
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment