diff --git a/Ryujinx.UI/Program.cs b/Ryujinx.UI/Program.cs index 375364be5f..5cd76c3347 100644 --- a/Ryujinx.UI/Program.cs +++ b/Ryujinx.UI/Program.cs @@ -1,12 +1,23 @@ -using System; +using Qml.Net; +using System; namespace Ryujinx.UI { class Program { - static void Main(string[] args) + static int Main(string[] args) { - Console.WriteLine("Hello World!"); + QQuickStyle.SetStyle("Material"); + + using (var Application = new QGuiApplication(args)) + { + using (var QmlEngine = new QQmlApplicationEngine()) + { + QmlEngine.Load("UI/MainWindow.qml"); + + return Application.Exec(); + } + } } } } diff --git a/Ryujinx.UI/Ryujinx.UI.csproj b/Ryujinx.UI/Ryujinx.UI.csproj index 4d016371cb..2172727cc1 100644 --- a/Ryujinx.UI/Ryujinx.UI.csproj +++ b/Ryujinx.UI/Ryujinx.UI.csproj @@ -1,4 +1,4 @@ - + Exe @@ -8,7 +8,19 @@ + + + + + + + + + Always + + + diff --git a/Ryujinx.UI/UI/Images/drawer.png b/Ryujinx.UI/UI/Images/drawer.png new file mode 100644 index 0000000000..60d93aff7b Binary files /dev/null and b/Ryujinx.UI/UI/Images/drawer.png differ diff --git a/Ryujinx.UI/UI/Images/loadFolder.svg b/Ryujinx.UI/UI/Images/loadFolder.svg new file mode 100644 index 0000000000..95c7faa4b6 --- /dev/null +++ b/Ryujinx.UI/UI/Images/loadFolder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Ryujinx.UI/UI/Images/loadGame.svg b/Ryujinx.UI/UI/Images/loadGame.svg new file mode 100644 index 0000000000..4f9a1ccc8a --- /dev/null +++ b/Ryujinx.UI/UI/Images/loadGame.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Ryujinx.UI/UI/Images/menu.png b/Ryujinx.UI/UI/Images/menu.png new file mode 100644 index 0000000000..187c171cde Binary files /dev/null and b/Ryujinx.UI/UI/Images/menu.png differ diff --git a/Ryujinx.UI/UI/MainWindow.qml b/Ryujinx.UI/UI/MainWindow.qml new file mode 100644 index 0000000000..f55bf342eb --- /dev/null +++ b/Ryujinx.UI/UI/MainWindow.qml @@ -0,0 +1,139 @@ +import QtQuick 2.9 +import QtQuick.Layouts 1.3 +import QtQuick.Controls 2.3 +import QtQuick.Controls.Material 2.1 +import QtQuick.Dialogs 1.0 + +ApplicationWindow { + id: window + width: 840 + height: 680 + visible: true + title: "Ryujinx" + + Material.theme: Material.Light + Material.accent: '#41cd52' + Material.primary: '#41cd52' + + header: ToolBar { + id: toolBar + + RowLayout { + id: rowLayout + anchors.fill: parent + spacing: 20 + + ToolButton { + id: drawerButton + text: qsTr("") + spacing: 3 + display: AbstractButton.IconOnly + icon.source: "./Images/drawer.png" + + onClicked: { + if (contentStack.depth > 1) { + contentStack.pop() + } else { + drawer.open() + } + } + } + + RowLayout { + id: mainControlPanel + Layout.fillHeight: true + Layout.fillWidth: true + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + + ToolButton { + id: openGameFileButton + display: AbstractButton.IconOnly + icon.source: "./Images/loadGame.svg" + ToolTip { + text: qsTr("Load Game File") + } + + onClicked: { + loadDialog.loadGame() + } + } + + ToolButton { + id: openGameFolderButton + display: AbstractButton.IconOnly + icon.source: "./Images/loadFolder.svg" + ToolTip { + text: qsTr("Load Game Folder") + } + + onClicked: { + loadDialog.loadGameFolder() + } + } + } + + ToolButton { + id: menuButton + text: qsTr("Tool Button") + } + } + } + + StackView { + id: contentStack + anchors.fill: parent + } + + Drawer { + id: drawer + width: Math.min(window.width, window.height) / 3 * 2 + height: window.height + interactive: stackView.depth === 1 + + ListView { + id: drawerMenuList + focus: true + currentIndex: -1 + anchors.fill: parent + + delegate: ItemDelegate { + width: parent.width + text: model.title + highlighted: ListView.isCurrentItem + } + + model: ListModel { + ListElement { title: "Games"} + ListElement { title: "Settings"} + ListElement { title: "Exit"} + } + + ScrollIndicator.vertical: ScrollIndicator { } + } + } + + FileDialog { + id: loadDialog + selectMultiple: false + nameFilters: ["Game Carts (*.xci)", + "Application Packages (*.nca *.nsp)", + "Executable (*.nso *.nro)", + "All Supported Formats (*.xci *.nca *.nsp *.nso *.nro)"] + + Component.onCompleted: visible = false + + function loadGame() { + selectFolder = false + title = qsTr("Load Game File") + + show() + } + + function loadGameFolder() { + selectFolder = true + title = qsTr("Load Game Folder") + + show() + } + } +}