committed by
crueter
No known key found for this signature in database
GPG Key ID: 425ACD2D4830EBC6
9 changed files with 244 additions and 65 deletions
-
26src/eden/interface/qt_config.cpp
-
24src/eden/interface/uisettings.h
-
3src/eden/models/GameListModel.cpp
-
7src/eden/qml/main/CMakeLists.txt
-
94src/eden/qml/main/GameCarousel.qml
-
44src/eden/qml/main/GameGrid.qml
-
0src/eden/qml/main/GameGridCard.qml
-
68src/eden/qml/main/GameList.qml
-
43src/eden/qml/main/MarqueeText.qml
@ -0,0 +1,94 @@ |
|||||
|
import QtQuick |
||||
|
import QtQuick.Controls |
||||
|
import Qt.labs.platform |
||||
|
import QtCore |
||||
|
|
||||
|
import org.eden_emu.constants |
||||
|
import org.eden_emu.interface |
||||
|
|
||||
|
ListView { |
||||
|
id: carousel |
||||
|
|
||||
|
focus: true |
||||
|
focusPolicy: Qt.StrongFocus |
||||
|
|
||||
|
model: EdenGameList |
||||
|
orientation: ListView.Horizontal |
||||
|
clip: false |
||||
|
flickDeceleration: 1000 |
||||
|
snapMode: ListView.SnapToItem |
||||
|
|
||||
|
onHeightChanged: console.log(width, height) |
||||
|
|
||||
|
spacing: 20 |
||||
|
|
||||
|
Keys.enabled: true |
||||
|
Keys.onRightPressed: incrementCurrentIndex() |
||||
|
Keys.onLeftPressed: decrementCurrentIndex() |
||||
|
|
||||
|
onCurrentIndexChanged: scrollToCenter() |
||||
|
|
||||
|
highlight: Rectangle { |
||||
|
id: hg |
||||
|
clip: false |
||||
|
z: 3 |
||||
|
|
||||
|
color: "transparent" |
||||
|
border { |
||||
|
color: "deepskyblue" |
||||
|
width: 4 * Constants.scalar |
||||
|
} |
||||
|
|
||||
|
radius: 8 * Constants.scalar |
||||
|
|
||||
|
// TODO: marquee |
||||
|
Text { |
||||
|
function toTitleCase(str) { |
||||
|
return str.replace(/\w\S*/g, text => text.charAt(0).toUpperCase( |
||||
|
) + text.substring(1).toLowerCase()) |
||||
|
} |
||||
|
|
||||
|
property var item: carousel.currentItem |
||||
|
|
||||
|
text: toTitleCase(item.title) |
||||
|
font.pixelSize: 22 * Constants.scalar |
||||
|
color: "lightblue" |
||||
|
|
||||
|
anchors { |
||||
|
bottom: hg.top |
||||
|
|
||||
|
bottomMargin: 10 * Constants.scalar |
||||
|
left: hg.left |
||||
|
right: hg.right |
||||
|
} |
||||
|
|
||||
|
horizontalAlignment: Text.AlignHCenter |
||||
|
elide: Text.ElideRight |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
highlightFollowsCurrentItem: true |
||||
|
highlightMoveDuration: 300 |
||||
|
highlightMoveVelocity: -1 |
||||
|
|
||||
|
delegate: GameCarouselCard { |
||||
|
id: game |
||||
|
width: 300 |
||||
|
height: 300 |
||||
|
} |
||||
|
|
||||
|
function scrollToCenter() { |
||||
|
let targetX = currentIndex * 320 - (width - 320) / 2 |
||||
|
let min = 0 |
||||
|
let max = contentWidth |
||||
|
|
||||
|
contentX = Math.max(min, Math.min(max, targetX)) |
||||
|
} |
||||
|
|
||||
|
Behavior on contentX { |
||||
|
NumberAnimation { |
||||
|
duration: 300 |
||||
|
easing.type: Easing.OutQuad |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,44 @@ |
|||||
|
import QtQuick |
||||
|
import QtQuick.Controls |
||||
|
import Qt.labs.platform |
||||
|
import QtCore |
||||
|
|
||||
|
import org.eden_emu.constants |
||||
|
import org.eden_emu.interface |
||||
|
import org.eden_emu.gamepad |
||||
|
|
||||
|
GridView { |
||||
|
property var setting |
||||
|
id: grid |
||||
|
|
||||
|
property int cellSize: Math.floor(width / setting.value) |
||||
|
|
||||
|
highlightFollowsCurrentItem: true |
||||
|
clip: true |
||||
|
|
||||
|
cellWidth: cellSize |
||||
|
cellHeight: cellSize + 60 * Constants.scalar |
||||
|
|
||||
|
model: EdenGameList |
||||
|
|
||||
|
delegate: GameGridCard { |
||||
|
id: game |
||||
|
|
||||
|
width: grid.cellSize - 20 * Constants.scalar |
||||
|
height: grid.cellHeight - 20 * Constants.scalar |
||||
|
} |
||||
|
|
||||
|
highlight: Rectangle { |
||||
|
color: "transparent" |
||||
|
z: 5 |
||||
|
|
||||
|
radius: 16 * Constants.scalar |
||||
|
border { |
||||
|
color: Constants.text |
||||
|
width: 3 |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
focus: true |
||||
|
focusPolicy: "StrongFocus" |
||||
|
} |
||||
@ -0,0 +1,43 @@ |
|||||
|
import QtQuick |
||||
|
|
||||
|
Item { |
||||
|
required property string text |
||||
|
|
||||
|
property int spacing: 30 |
||||
|
property int startDelay: 2000 |
||||
|
property int speed: 40 |
||||
|
|
||||
|
property alias font: t1.font |
||||
|
property alias color: t1.color |
||||
|
|
||||
|
id: root |
||||
|
|
||||
|
width: t1.width + spacing |
||||
|
height: t1.height |
||||
|
clip: true |
||||
|
|
||||
|
Text { |
||||
|
id: t1 |
||||
|
|
||||
|
SequentialAnimation on x { |
||||
|
loops: Animation.Infinite |
||||
|
running: true |
||||
|
|
||||
|
PauseAnimation { |
||||
|
duration: root.startDelay |
||||
|
} |
||||
|
|
||||
|
NumberAnimation { |
||||
|
from: root.width |
||||
|
to: -t1.width |
||||
|
duration: (root.width + t1.width) * 1000 / root.speed |
||||
|
easing.type: Easing.Linear |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
Text { |
||||
|
x: root.width |
||||
|
text: t1.text |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue