Skip to content

Commit

Permalink
Begin implementing a counter item for the edh app.
Browse files Browse the repository at this point in the history
  • Loading branch information
ASxa86 committed Aug 20, 2024
1 parent 7b45343 commit 5c1b480
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 83 deletions.
90 changes: 7 additions & 83 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,100 +5,24 @@
"version": "0.2.0",
"configurations": [
{
"name": "(Windows) Launch Shapes Debug",
"name": "(Windows) Aspire Edit Debug",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build/bin/Debug/shapes.exe",
"program": "${workspaceFolder}/build-debug/installed/bin/aspire-edit.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/build/bin/Debug",
"environment": [
{
"name": "QML_IMPORT_PATH",
"value": "${workspaceFolder}/build/vcpkg_installed/x64-windows/debug/Qt6/qml"
},
{
"name": "QT_PLUGIN_PATH",
"value": "${workspaceFolder}/build/vcpkg_installed/x64-windows/debug/Qt6/plugins"
},
{
"name": "PATH",
"value": "${workspaceFolder}/build/vcpkg_installed/x64-windows/debug/bin"
}
],
"cwd": "${workspaceFolder}/build-debug/installed/bin",
"console": "externalTerminal"
},
{
"name": "(Windows) Launch Release",
"name": "(Windows) Aspire EDH Debug",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build/bin/Release/shapes.exe",
"program": "${workspaceFolder}/build-debug/installed/bin/aspire-edh.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/build/bin/Release",
"environment": [
{
"name": "QML_IMPORT_PATH",
"value": "${workspaceFolder}/build/vcpkg_installed/x64-windows/Qt6/qml"
},
{
"name": "QT_PLUGIN_PATH",
"value": "${workspaceFolder}/build/vcpkg_installed/x64-windows/Qt6/plugins"
},
{
"name": "PATH",
"value": "${workspaceFolder}/build/vcpkg_installed/x64-windows/bin"
}
],
"cwd": "${workspaceFolder}/build-debug/installed/bin",
"console": "externalTerminal"
},
{
"name": "(Windows) Launch RelWithDebInfo",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build/bin/RelWithDebInfo/shapes.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/build/bin/RelWithDebInfo",
"environment": [
{
"name": "QML_IMPORT_PATH",
"value": "${workspaceFolder}/build/vcpkg_installed/x64-windows/Qt6/qml"
},
{
"name": "QT_PLUGIN_PATH",
"value": "${workspaceFolder}/build/vcpkg_installed/x64-windows/Qt6/plugins"
},
{
"name": "PATH",
"value": "${workspaceFolder}/build/vcpkg_installed/x64-windows/bin"
}
],
"console": "externalTerminal"
},
{
"name": "(Windows) Launch EDHStats Debug",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build/bin/Debug/edhstats.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/build/bin/Debug",
"environment": [
{
"name": "QML_IMPORT_PATH",
"value": "${workspaceFolder}/build/vcpkg_installed/x64-windows/debug/Qt6/qml"
},
{
"name": "QT_PLUGIN_PATH",
"value": "${workspaceFolder}/build/vcpkg_installed/x64-windows/debug/Qt6/plugins"
},
{
"name": "PATH",
"value": "${workspaceFolder}/build/vcpkg_installed/x64-windows/debug/bin"
}
],
"console": "externalTerminal"
},
}
]
}
1 change: 1 addition & 0 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
add_subdirectory(edit)
add_subdirectory(edh)
12 changes: 12 additions & 0 deletions app/edh/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
project(aspire-edh)

project_add_executable(${PROJECT_NAME})

target_sources(${PROJECT_NAME} PRIVATE
main.cpp
)

target_link_libraries(${PROJECT_NAME} PRIVATE
Qt::Quick
aspireplugin
)
57 changes: 57 additions & 0 deletions app/edh/Main.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import QtQuick
import aspire

Rectangle {
width: 1280
height: 720
anchors.fill: parent
color: "blue"
border.width: 4
border.color: "grey"

Counter {
color: "red"
width: parent.width / 2
height: parent.height / 2
rotation: 180
value: 40
}

Counter {
color: "blue"
x: parent.width / 2
width: parent.width / 2
height: parent.height / 2
rotation: 180
value: 40
}

Counter {
color: "green"
y: parent.height / 2
width: parent.width / 2
height: parent.height / 2
value: 40
}

Counter {
color: "brown"
y: parent.height / 2
x: parent.width / 2
width: parent.width / 2
height: parent.height / 2
value: 40
}

FrameMetrics {
id: metrics

thread: FrameMetrics.Thread.Render
}

Text {
text: metrics.fpsRolling.toFixed(2)
color: "white"
font.pixelSize: 50
}
}
21 changes: 21 additions & 0 deletions app/edh/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQuickView>

int main(int argc, char** argv)
{
const QGuiApplication app{argc, argv};

QQuickView window{};

constexpr auto width{1280};
constexpr auto height{720};
window.setWidth(width);
window.setHeight(height);
window.setTitle("Aspire EDH");
window.engine()->addImportPath(":/");
window.setSource(QUrl{"qrc:/aspire/edh/Main.qml"});
window.show();

return QGuiApplication::exec();
}
1 change: 1 addition & 0 deletions module/aspire/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ project_add_module(
Meters.cpp
Meters.h
QML_FILES
Counter.qml
Square.qml
IMPORTS
QtQuick
Expand Down
45 changes: 45 additions & 0 deletions module/aspire/Counter.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import QtQuick

Rectangle {
id: root

property int value: 0

border.color: "red"
border.width: 2
color: Qt.rgba(0.5, 0.5, 0.5, 0.5)

Text {
id: text

anchors.fill: text.parent
text: root.value.toString()
font.pixelSize: text.height
color: "white"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}

MouseArea {
id: left

height: root.height
width: root.width / 2

onClicked: {
root.value -= 1;
}
}

MouseArea {
id: right

x: root.width / 2
height: root.height
width: root.width / 2

onClicked: {
root.value += 1;
}
}
}

0 comments on commit 5c1b480

Please sign in to comment.