212 lines
5.7 KiB
QML
Raw Normal View History

2015-09-01 23:48:48 -05:00
import QtQuick 2.2
import Material 0.1
import Material.ListItems 0.1 as ListItem
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
ApplicationWindow {
2015-04-12 15:20:57 -04:00
id: mainWindow
title: "RetroArch"
width: 1280
height: 720
color: "#211822"
visible: true
2015-09-01 23:48:48 -05:00
theme {
primaryColor: Palette.colors["blue"]["500"]
primaryDarkColor: Palette.colors["blue"]["700"]
accentColor: Palette.colors["red"]["A200"]
tabHighlightColor: "white"
}
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
/* temporary top level folder list */
property var folders: [
"C:\\", "D:\\"
]
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
property var sections: [ collections, cores, folders ]
property var sectionTitles: [ "Collections", "Cores", "File Browser" ]
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
property string selectedItem: collections[0]
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
initialPage: Page {
id: page
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
title: "RetroArch"
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
tabs: navDrawer.enabled ? [] : sectionTitles
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
actionBar.maxActionCount: navDrawer.enabled ? 3 : 4
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
actions: [
Action {
iconName: "action/search"
name: "Search"
enabled: true
},
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
Action {
iconName: "image/color_lens"
name: "Colors"
onTriggered: colorPicker.show()
},
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
Action {
iconName: "action/settings"
name: "Settings"
hoverAnimation: true
},
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
Action {
iconName: "action/language"
name: "Language"
enabled: true
},
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
Action {
iconName: "action/account_circle"
name: "Accounts"
}
]
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
backAction: navDrawer.action
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
NavigationDrawer {
id: navDrawer
enabled: page.width < Units.dp(500)
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
Flickable {
anchors.fill: parent
contentHeight: Math.max(content.implicitHeight, height)
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
Column {
id: content
anchors.fill: parent
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
Repeater {
model: sections
delegate: ListItem.Standard {
width: parent.width
ListItem.Subheader {
text: sectionTitles[index]
}
}
2015-04-12 15:20:57 -04:00
}
}
2015-09-01 23:48:48 -05:00
}
}
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
TabView {
id: tabView
anchors.fill: parent
currentIndex: page.selectedTab
model: sections
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
delegate: Item {
width: tabView.width
height: tabView.height
clip: true
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
Sidebar {
id: sidebar
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
expanded: !navDrawer.enabled
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
Column {
width: parent.width
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
Repeater {
model: modelData
delegate: ListItem.Standard {
text: modelData
selected: modelData == selectedItem
onClicked: selectedItem = modelData
}
2015-04-12 15:20:57 -04:00
}
}
}
2015-09-01 23:48:48 -05:00
Flickable {
id: flickable
anchors {
left: sidebar.right
right: parent.right
top: parent.top
bottom: parent.bottom
}
clip: true
Column {
width: parent.width
}
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
}
Scrollbar {
flickableItem: flickable
}
2015-04-12 15:20:57 -04:00
}
}
}
2015-09-01 23:48:48 -05:00
Dialog {
id: colorPicker
title: "Pick color"
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
positiveButtonText: "Done"
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
MenuField {
id: selection
model: ["Primary color", "Accent color", "Background color"]
width: Units.dp(160)
}
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
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;
}
}
}
}
}
}
2015-04-12 15:20:57 -04:00
2015-09-01 23:48:48 -05:00
onRejected: {
// TODO set default colors again but we currently don't know what that is
}
}
2015-04-12 15:20:57 -04:00
}