mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 15:40:44 +00:00
Populate core list and collection list
This commit is contained in:
parent
b32a3e55f4
commit
51a4370dda
@ -1,301 +1,211 @@
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Window 2.2
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick 2.2
|
||||
import Material 0.1
|
||||
import Material.ListItems 0.1 as ListItem
|
||||
|
||||
|
||||
Window {
|
||||
ApplicationWindow {
|
||||
id: mainWindow
|
||||
title: "RetroArch"
|
||||
width: 1280
|
||||
height: 720
|
||||
color: "#211822"
|
||||
visible: true
|
||||
|
||||
SplitView {
|
||||
anchors.fill: parent
|
||||
orientation: Qt.Horizontal
|
||||
|
||||
Rectangle {
|
||||
id: consoleBar;
|
||||
color: "#2b2b2b";
|
||||
height: 500;
|
||||
width: 250;
|
||||
Layout.maximumWidth: 400
|
||||
|
||||
Rectangle {
|
||||
id: rightBord;
|
||||
anchors {
|
||||
top: parent.top;
|
||||
bottom: parent.bottom;
|
||||
right: parent.right;
|
||||
}
|
||||
width: 1;
|
||||
color: "#1a1a1a";
|
||||
}
|
||||
|
||||
Row {
|
||||
id: leftBord;
|
||||
anchors {
|
||||
left: parent.left;
|
||||
top: parent.top;
|
||||
bottom: parent.bottom;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Rectangle {
|
||||
id: consoleHeader;
|
||||
height: 36;
|
||||
color: parent.color;
|
||||
|
||||
anchors {
|
||||
top: parent.top;
|
||||
//topMargin: 12;
|
||||
left: parent.left;
|
||||
right: parent.right;
|
||||
rightMargin: 1;
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouse;
|
||||
anchors.fill: parent;
|
||||
onClicked: {
|
||||
if (listView.retractList)
|
||||
listView.retractList = false;
|
||||
else
|
||||
listView.retractList = true;
|
||||
}
|
||||
}
|
||||
Row {
|
||||
anchors {
|
||||
left: parent.left;
|
||||
top: parent.top;
|
||||
topMargin: 12;
|
||||
leftMargin: 12;
|
||||
horizontalCenter: parent.horizontalCenter;
|
||||
}
|
||||
Text {
|
||||
renderType: Text.QtRendering;
|
||||
text: "Platforms";
|
||||
color: "#f1f1f1";
|
||||
font {
|
||||
bold: true;
|
||||
family: "Sans";
|
||||
pixelSize: 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
ListModel {
|
||||
id: platformsModel
|
||||
ListElement { name: "Megadrive" }
|
||||
ListElement { name: "Nintendo" }
|
||||
ListElement { name: "Playstation" }
|
||||
}
|
||||
ListView {
|
||||
id: listView;
|
||||
visible: (height !== 0);
|
||||
anchors {
|
||||
top: consoleHeader.bottom;
|
||||
//bottom: parent.bottom;
|
||||
right: parent.right;
|
||||
left: parent.left;
|
||||
topMargin: 0;
|
||||
}
|
||||
|
||||
height: retractList ? 0 : 500;
|
||||
|
||||
Behavior on height {
|
||||
PropertyAnimation {}
|
||||
}
|
||||
|
||||
snapMode: ListView.SnapToItem;
|
||||
orientation: ListView.Vertical;
|
||||
interactive: true;
|
||||
highlightFollowsCurrentItem: false;
|
||||
|
||||
property bool retractList: false;
|
||||
|
||||
highlight: Item {
|
||||
id: highlightItem;
|
||||
visible: !listView.retractList;
|
||||
height: listView.currentItem.height;
|
||||
width: listView.width;
|
||||
anchors.verticalCenter: listView.currentItem.verticalCenter;
|
||||
y: listView.currentItem.y;
|
||||
Item {
|
||||
id: innerItem;
|
||||
height: parent.height;
|
||||
width: parent.width;
|
||||
|
||||
|
||||
|
||||
|
||||
Rectangle {
|
||||
id: mainColor;
|
||||
anchors {
|
||||
left: parent.left;
|
||||
right: parent.right;
|
||||
top: parent.top;
|
||||
bottom: parent.bottom;
|
||||
}
|
||||
color: listView.currentItem ? "#171717" : "#000000FF";
|
||||
Rectangle {
|
||||
id: topBorder;
|
||||
color: "#f27b77";
|
||||
anchors {
|
||||
left: parent.left;
|
||||
leftMargin: leftBord.width;
|
||||
top: parent.top;
|
||||
}
|
||||
height: 2;
|
||||
width: 4;
|
||||
}
|
||||
|
||||
Row {
|
||||
// leftAccent;
|
||||
anchors {
|
||||
left: parent.left;
|
||||
leftMargin: leftBord.width;
|
||||
bottom: bottomB.top;
|
||||
top: topBorder.bottom;
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors {
|
||||
top: parent.top;
|
||||
bottom: parent.bottom;
|
||||
}
|
||||
width: 1;
|
||||
color: "#db5753";
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors {
|
||||
top: parent.top;
|
||||
bottom: parent.bottom;
|
||||
}
|
||||
width: 3;
|
||||
color: "#e8433f";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Column {
|
||||
id: bottomB;
|
||||
anchors {
|
||||
right: parent.right;
|
||||
rightMargin: rightBord.width;
|
||||
left: parent.left;
|
||||
leftMargin: leftBord.width;
|
||||
bottom: parent.bottom;
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
color: "#a22f2c";
|
||||
anchors {
|
||||
left: parent.left;
|
||||
}
|
||||
width: 4;
|
||||
height: 2;
|
||||
}
|
||||
Rectangle {
|
||||
color: "#474747";
|
||||
anchors {
|
||||
left: parent.left;
|
||||
right: parent.right;
|
||||
}
|
||||
height: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
anchors {
|
||||
right: parent.right;
|
||||
left: parent.left;
|
||||
top: consoleLabel.bottom;
|
||||
topMargin: 10;
|
||||
}
|
||||
|
||||
model: platformsModel;
|
||||
|
||||
ExclusiveGroup {
|
||||
id: consoleGroup
|
||||
}
|
||||
|
||||
delegate: Item {
|
||||
//visible: !listView.retractList;
|
||||
height: 22;
|
||||
width: consoleBar.width;
|
||||
Row {
|
||||
id: row;
|
||||
anchors {
|
||||
fill: parent;
|
||||
leftMargin: 25;
|
||||
}
|
||||
spacing: 7;
|
||||
|
||||
Image {
|
||||
anchors.verticalCenter: parent.verticalCenter;
|
||||
fillMode: Image.PreserveAspectFit;
|
||||
sourceSize {
|
||||
height: 24;
|
||||
width: 24;
|
||||
}
|
||||
height: 20;
|
||||
width: 20;
|
||||
}
|
||||
|
||||
Text {
|
||||
id: consoleItem;
|
||||
anchors.verticalCenter: parent.verticalCenter;
|
||||
width: 140;
|
||||
text: modelData;
|
||||
color: "#f1f1f1";
|
||||
renderType: Text.QtRendering;
|
||||
elide: Text.ElideRight;
|
||||
font {
|
||||
family: "Sans";
|
||||
pixelSize: 11;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent;
|
||||
onClicked: {
|
||||
listView.currentIndex = index;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: centerItem
|
||||
Layout.minimumWidth: 50
|
||||
Layout.fillWidth: true
|
||||
color: "lightgray"
|
||||
Text {
|
||||
text: "Content View"
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
theme {
|
||||
primaryColor: Palette.colors["blue"]["500"]
|
||||
primaryDarkColor: Palette.colors["blue"]["700"]
|
||||
accentColor: Palette.colors["red"]["A200"]
|
||||
tabHighlightColor: "white"
|
||||
}
|
||||
|
||||
/* temporary top level folder list */
|
||||
property var folders: [
|
||||
"C:\\", "D:\\"
|
||||
]
|
||||
|
||||
property var sections: [ collections, cores, folders ]
|
||||
property var sectionTitles: [ "Collections", "Cores", "File Browser" ]
|
||||
|
||||
property string selectedItem: collections[0]
|
||||
|
||||
|
||||
initialPage: Page {
|
||||
id: page
|
||||
|
||||
title: "RetroArch"
|
||||
|
||||
tabs: navDrawer.enabled ? [] : sectionTitles
|
||||
|
||||
actionBar.maxActionCount: navDrawer.enabled ? 3 : 4
|
||||
|
||||
actions: [
|
||||
Action {
|
||||
iconName: "action/search"
|
||||
name: "Search"
|
||||
enabled: true
|
||||
},
|
||||
|
||||
Action {
|
||||
iconName: "image/color_lens"
|
||||
name: "Colors"
|
||||
onTriggered: colorPicker.show()
|
||||
},
|
||||
|
||||
Action {
|
||||
iconName: "action/settings"
|
||||
name: "Settings"
|
||||
hoverAnimation: true
|
||||
},
|
||||
|
||||
|
||||
Action {
|
||||
iconName: "action/language"
|
||||
name: "Language"
|
||||
enabled: true
|
||||
},
|
||||
|
||||
Action {
|
||||
iconName: "action/account_circle"
|
||||
name: "Accounts"
|
||||
}
|
||||
]
|
||||
|
||||
backAction: navDrawer.action
|
||||
|
||||
NavigationDrawer {
|
||||
id: navDrawer
|
||||
enabled: page.width < Units.dp(500)
|
||||
|
||||
|
||||
Flickable {
|
||||
anchors.fill: parent
|
||||
|
||||
contentHeight: Math.max(content.implicitHeight, height)
|
||||
|
||||
Column {
|
||||
id: content
|
||||
anchors.fill: parent
|
||||
|
||||
Repeater {
|
||||
model: sections
|
||||
|
||||
delegate: ListItem.Standard {
|
||||
width: parent.width
|
||||
ListItem.Subheader {
|
||||
text: sectionTitles[index]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TabView {
|
||||
id: tabView
|
||||
anchors.fill: parent
|
||||
currentIndex: page.selectedTab
|
||||
model: sections
|
||||
|
||||
|
||||
delegate: Item {
|
||||
width: tabView.width
|
||||
height: tabView.height
|
||||
clip: true
|
||||
|
||||
Sidebar {
|
||||
id: sidebar
|
||||
|
||||
expanded: !navDrawer.enabled
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
|
||||
Repeater {
|
||||
model: modelData
|
||||
delegate: ListItem.Standard {
|
||||
text: modelData
|
||||
selected: modelData == selectedItem
|
||||
onClicked: selectedItem = modelData
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Flickable {
|
||||
id: flickable
|
||||
anchors {
|
||||
left: sidebar.right
|
||||
right: parent.right
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
clip: true
|
||||
Column {
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
}
|
||||
Scrollbar {
|
||||
flickableItem: flickable
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Dialog {
|
||||
id: colorPicker
|
||||
title: "Pick color"
|
||||
|
||||
positiveButtonText: "Done"
|
||||
|
||||
MenuField {
|
||||
id: selection
|
||||
model: ["Primary color", "Accent color", "Background color"]
|
||||
width: Units.dp(160)
|
||||
}
|
||||
|
||||
Grid {
|
||||
columns: 7
|
||||
spacing: Units.dp(8)
|
||||
|
||||
Repeater {
|
||||
model: [
|
||||
"red", "pink", "purple", "deepPurple", "indigo",
|
||||
"blue", "lightBlue", "cyan", "teal", "green",
|
||||
"lightGreen", "lime", "yellow", "amber", "orange",
|
||||
"deepOrange", "grey", "blueGrey", "brown", "black",
|
||||
"white"
|
||||
]
|
||||
|
||||
Rectangle {
|
||||
width: Units.dp(30)
|
||||
height: Units.dp(30)
|
||||
radius: Units.dp(2)
|
||||
color: Palette.colors[modelData]["500"]
|
||||
border.width: modelData === "white" ? Units.dp(2) : 0
|
||||
border.color: Theme.alpha("#000", 0.26)
|
||||
|
||||
Ink {
|
||||
anchors.fill: parent
|
||||
|
||||
onPressed: {
|
||||
switch(selection.selectedIndex) {
|
||||
case 0:
|
||||
theme.primaryColor = parent.color
|
||||
break;
|
||||
case 1:
|
||||
theme.accentColor = parent.color
|
||||
break;
|
||||
case 2:
|
||||
theme.backgroundColor = parent.color
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onRejected: {
|
||||
// TODO set default colors again but we currently don't know what that is
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,18 +17,34 @@
|
||||
#include "stdio.h"
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QListView>
|
||||
#include <QQuickWindow>
|
||||
#include <QDir>
|
||||
#include <QDebug>
|
||||
#include <QQmlContext>
|
||||
|
||||
QObject *topLevel;
|
||||
|
||||
int Wimp::CreateMainWindow()
|
||||
{
|
||||
QQmlApplicationEngine engine;
|
||||
|
||||
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
||||
topLevel = engine.rootObjects().value(0);
|
||||
window = qobject_cast<QQuickWindow *>(topLevel);
|
||||
|
||||
if(settings->playlist_directory[0] != '\0')
|
||||
GetCollections(settings->playlist_directory);
|
||||
else
|
||||
collections.append("Collection dir not defined");
|
||||
|
||||
engine.rootContext()->setContextProperty("collections", QVariant::fromValue(collections));
|
||||
|
||||
if(settings->libretro_directory[0] != '\0')
|
||||
GetCores(settings->libretro_directory);
|
||||
else
|
||||
cores.append("Core dir not defined");
|
||||
|
||||
engine.rootContext()->setContextProperty("cores", QVariant::fromValue(cores));
|
||||
|
||||
return this->exec();
|
||||
|
||||
}
|
||||
@ -37,3 +53,39 @@ void Wimp::GetSettings(settings_t *s)
|
||||
{
|
||||
settings = s;
|
||||
}
|
||||
|
||||
void Wimp::GetCollections(char* path)
|
||||
{
|
||||
QDir dir(path);
|
||||
dir.setNameFilters(QStringList("*.lpl"));
|
||||
QStringList fileList = dir.entryList();
|
||||
|
||||
if(fileList.count() == 0)
|
||||
collections.append("Empty");
|
||||
|
||||
for (int i=0; i < fileList.count(); i++)
|
||||
{
|
||||
QString collection = fileList[i].section('.',0,0);
|
||||
collections.append(collection);
|
||||
qDebug() << "Found file: " << collection;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Wimp::GetCores(char* path)
|
||||
{
|
||||
QDir dir(path);
|
||||
dir.setNameFilters(QStringList("*.dll"));
|
||||
QStringList fileList = dir.entryList();
|
||||
|
||||
if(fileList.count() == 0)
|
||||
cores.append("Empty");
|
||||
|
||||
for (int i=0; i < fileList.count(); i++)
|
||||
{
|
||||
QString core = fileList[i].section('.',0,0);
|
||||
cores.append(core);
|
||||
qDebug() << "Found file: " << core;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -47,10 +47,17 @@ class WIMPSHARED_EXPORT Wimp : public QGuiApplication
|
||||
/* get a pointer to RetroArch settings */
|
||||
void GetSettings(settings_t *s);
|
||||
|
||||
void GetCollections(char* path);
|
||||
void GetCores(char* path);
|
||||
|
||||
private:
|
||||
/* pointer to RetroArch settings */
|
||||
settings_t *settings;
|
||||
QStringList collections;
|
||||
QStringList cores;
|
||||
QQmlApplicationEngine engine;
|
||||
|
||||
};
|
||||
|
||||
#endif // WIMP_H
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user