mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 17:35:45 +02:00
More UI work
This commit is contained in:
parent
28c9aa031c
commit
9e6502fe92
5 changed files with 178 additions and 56 deletions
|
@ -48,6 +48,7 @@ ScrollingWindow {
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
ApplicationInterface.uploadRequest.connect(uploadClicked);
|
ApplicationInterface.uploadRequest.connect(uploadClicked);
|
||||||
assetMappingsModel.errorGettingMappings.connect(handleGetMappingsError);
|
assetMappingsModel.errorGettingMappings.connect(handleGetMappingsError);
|
||||||
|
|
||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,20 +465,10 @@ ScrollingWindow {
|
||||||
HifiControls.VerticalSpacer {}
|
HifiControls.VerticalSpacer {}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: buttonRow
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
spacing: hifi.dimensions.contentSpacing.x
|
spacing: hifi.dimensions.contentSpacing.x
|
||||||
|
|
||||||
HifiControls.GlyphButton {
|
|
||||||
glyph: hifi.glyphs.reload
|
|
||||||
color: hifi.buttons.black
|
|
||||||
colorScheme: root.colorScheme
|
|
||||||
width: hifi.dimensions.controlLineHeight
|
|
||||||
|
|
||||||
onClicked: root.reload()
|
|
||||||
}
|
|
||||||
|
|
||||||
HifiControls.Button {
|
HifiControls.Button {
|
||||||
text: "Add To World"
|
text: "Add To World"
|
||||||
color: hifi.buttons.black
|
color: hifi.buttons.black
|
||||||
|
@ -510,8 +501,64 @@ ScrollingWindow {
|
||||||
onClicked: root.deleteFile()
|
onClicked: root.deleteFile()
|
||||||
enabled: treeView.selection.hasSelection
|
enabled: treeView.selection.hasSelection
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
HifiControls.GlyphButton {
|
||||||
|
|
||||||
|
glyph: hifi.glyphs.reload
|
||||||
|
color: hifi.buttons.black
|
||||||
|
colorScheme: root.colorScheme
|
||||||
|
width: hifi.dimensions.controlLineHeight
|
||||||
|
|
||||||
|
onClicked: root.reload()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HifiControls.Tree {
|
||||||
|
id: treeView
|
||||||
|
anchors.top: assetDirectory.bottom
|
||||||
|
anchors.bottom: infoRow.top
|
||||||
|
anchors.margins: hifi.dimensions.contentMargin.x + 2 // Extra for border
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
|
||||||
|
treeModel: assetProxyModel
|
||||||
|
selectionMode: SelectionMode.ExtendedSelection
|
||||||
|
headerVisible: true
|
||||||
|
sortIndicatorVisible: true
|
||||||
|
|
||||||
|
canEdit: true
|
||||||
|
colorScheme: root.colorScheme
|
||||||
|
|
||||||
|
modifyEl: renameEl
|
||||||
|
|
||||||
|
TableViewColumn {
|
||||||
|
id: nameColumn
|
||||||
|
title: "Name:"
|
||||||
|
role: "name"
|
||||||
|
width: treeView.width - bakedColumn.width;
|
||||||
|
}
|
||||||
|
TableViewColumn {
|
||||||
|
id: bakedColumn
|
||||||
|
title: "Use Baked?"
|
||||||
|
role: "baked"
|
||||||
|
width: 120
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
propagateComposedEvents: true
|
||||||
|
anchors.fill: parent
|
||||||
|
acceptedButtons: Qt.RightButton
|
||||||
|
onClicked: {
|
||||||
|
if (!HMD.active) { // Popup only displays properly on desktop
|
||||||
|
var index = treeView.indexAt(mouse.x, mouse.y);
|
||||||
|
treeView.selection.setCurrentIndex(index, 0x0002);
|
||||||
|
contextMenu.currentIndex = index;
|
||||||
|
contextMenu.popup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Menu {
|
Menu {
|
||||||
id: contextMenu
|
id: contextMenu
|
||||||
title: "Edit"
|
title: "Edit"
|
||||||
|
@ -541,36 +588,25 @@ ScrollingWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HifiControls.Tree {
|
Row {
|
||||||
id: treeView
|
id: infoRow
|
||||||
anchors.top: assetDirectory.bottom
|
anchors.left: treeView.left
|
||||||
|
anchors.right: treeView.right
|
||||||
anchors.bottom: uploadSection.top
|
anchors.bottom: uploadSection.top
|
||||||
anchors.margins: hifi.dimensions.contentMargin.x + 2 // Extra for border
|
anchors.bottomMargin: hifi.dimensions.contentSpacing.y
|
||||||
anchors.left: parent.left
|
spacing: hifi.dimensions.contentSpacing.x
|
||||||
anchors.right: parent.right
|
|
||||||
|
HifiControls.Label {
|
||||||
treeModel: assetProxyModel
|
text: treeView.selection.selectedIndexes.length + " ITEMS SELECTED"
|
||||||
canEdit: true
|
colorScheme: root.colorScheme
|
||||||
colorScheme: root.colorScheme
|
|
||||||
selectionMode: SelectionMode.ExtendedSelection
|
|
||||||
|
|
||||||
modifyEl: renameEl
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
propagateComposedEvents: true
|
|
||||||
anchors.fill: parent
|
|
||||||
acceptedButtons: Qt.RightButton
|
|
||||||
onClicked: {
|
|
||||||
if (!HMD.active) { // Popup only displays properly on desktop
|
|
||||||
var index = treeView.indexAt(mouse.x, mouse.y);
|
|
||||||
treeView.selection.setCurrentIndex(index, 0x0002);
|
|
||||||
contextMenu.currentIndex = index;
|
|
||||||
contextMenu.popup();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HifiControls.CheckBox {
|
||||||
|
text: "Use baked (optimized) versions"
|
||||||
|
colorScheme: root.colorScheme
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HifiControls.ContentSection {
|
HifiControls.ContentSection {
|
||||||
id: uploadSection
|
id: uploadSection
|
||||||
name: "Upload A File"
|
name: "Upload A File"
|
||||||
|
|
|
@ -20,6 +20,7 @@ TreeView {
|
||||||
|
|
||||||
property var treeModel: ListModel { }
|
property var treeModel: ListModel { }
|
||||||
property var canEdit: false
|
property var canEdit: false
|
||||||
|
property bool centerHeaderText: false
|
||||||
property int colorScheme: hifi.colorSchemes.light
|
property int colorScheme: hifi.colorSchemes.light
|
||||||
readonly property bool isLightColorScheme: colorScheme == hifi.colorSchemes.light
|
readonly property bool isLightColorScheme: colorScheme == hifi.colorSchemes.light
|
||||||
|
|
||||||
|
@ -30,14 +31,9 @@ TreeView {
|
||||||
model: treeModel
|
model: treeModel
|
||||||
}
|
}
|
||||||
|
|
||||||
TableViewColumn {
|
|
||||||
role: "display";
|
|
||||||
}
|
|
||||||
|
|
||||||
anchors { left: parent.left; right: parent.right }
|
anchors { left: parent.left; right: parent.right }
|
||||||
|
|
||||||
headerVisible: false
|
headerVisible: false
|
||||||
headerDelegate: Item { } // Fix OSX QML bug that displays scrollbar starting too low.
|
|
||||||
|
|
||||||
// Use rectangle to draw border with rounded corners.
|
// Use rectangle to draw border with rounded corners.
|
||||||
frameVisible: false
|
frameVisible: false
|
||||||
|
@ -60,6 +56,64 @@ TreeView {
|
||||||
// Needed in order for rows to keep displaying rows after end of table entries.
|
// Needed in order for rows to keep displaying rows after end of table entries.
|
||||||
backgroundColor: parent.isLightColorScheme ? hifi.colors.tableRowLightEven : hifi.colors.tableRowDarkEven
|
backgroundColor: parent.isLightColorScheme ? hifi.colors.tableRowLightEven : hifi.colors.tableRowDarkEven
|
||||||
alternateBackgroundColor: parent.isLightColorScheme ? hifi.colors.tableRowLightOdd : hifi.colors.tableRowDarkOdd
|
alternateBackgroundColor: parent.isLightColorScheme ? hifi.colors.tableRowLightOdd : hifi.colors.tableRowDarkOdd
|
||||||
|
|
||||||
|
headerDelegate: Rectangle {
|
||||||
|
height: hifi.dimensions.tableHeaderHeight
|
||||||
|
color: isLightColorScheme ? hifi.colors.tableBackgroundLight : hifi.colors.tableBackgroundDark
|
||||||
|
|
||||||
|
RalewayRegular {
|
||||||
|
id: titleText
|
||||||
|
text: styleData.value
|
||||||
|
size: hifi.fontSizes.tableHeading
|
||||||
|
font.capitalization: Font.AllUppercase
|
||||||
|
color: hifi.colors.baseGrayHighlight
|
||||||
|
horizontalAlignment: (centerHeaderText ? Text.AlignHCenter : Text.AlignLeft)
|
||||||
|
elide: Text.ElideRight
|
||||||
|
anchors {
|
||||||
|
left: parent.left
|
||||||
|
leftMargin: hifi.dimensions.tablePadding
|
||||||
|
right: sortIndicatorVisible && sortIndicatorColumn === styleData.column ? titleSort.left : parent.right
|
||||||
|
rightMargin: hifi.dimensions.tablePadding
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HiFiGlyphs {
|
||||||
|
id: titleSort
|
||||||
|
text: sortIndicatorOrder == Qt.AscendingOrder ? hifi.glyphs.caratUp : hifi.glyphs.caratDn
|
||||||
|
color: isLightColorScheme ? hifi.colors.darkGray : hifi.colors.baseGrayHighlight
|
||||||
|
opacity: 0.6;
|
||||||
|
size: hifi.fontSizes.tableHeadingIcon
|
||||||
|
anchors {
|
||||||
|
right: parent.right
|
||||||
|
verticalCenter: titleText.verticalCenter
|
||||||
|
}
|
||||||
|
visible: sortIndicatorVisible && sortIndicatorColumn === styleData.column
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: 1
|
||||||
|
anchors {
|
||||||
|
left: parent.left
|
||||||
|
top: parent.top
|
||||||
|
topMargin: 1
|
||||||
|
bottom: parent.bottom
|
||||||
|
bottomMargin: 2
|
||||||
|
}
|
||||||
|
color: isLightColorScheme ? hifi.colors.lightGrayText : hifi.colors.baseGrayHighlight
|
||||||
|
visible: styleData.column > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
height: 1
|
||||||
|
anchors {
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
bottom: parent.bottom
|
||||||
|
}
|
||||||
|
color: isLightColorScheme ? hifi.colors.lightGrayText : hifi.colors.baseGrayHighlight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
branchDelegate: HiFiGlyphs {
|
branchDelegate: HiFiGlyphs {
|
||||||
text: styleData.isExpanded ? hifi.glyphs.caratDn : hifi.glyphs.caratR
|
text: styleData.isExpanded ? hifi.glyphs.caratDn : hifi.glyphs.caratR
|
||||||
|
@ -75,28 +129,53 @@ TreeView {
|
||||||
|
|
||||||
handle: Item {
|
handle: Item {
|
||||||
id: scrollbarHandle
|
id: scrollbarHandle
|
||||||
implicitWidth: 6
|
implicitWidth: hifi.dimensions.scrollbarHandleWidth
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors {
|
anchors {
|
||||||
fill: parent
|
fill: parent
|
||||||
leftMargin: 2 // Move it right
|
topMargin: treeView.headerVisible ? hifi.dimensions.tableHeaderHeight + 3 : 3
|
||||||
rightMargin: -2 // ""
|
|
||||||
topMargin: 3 // Shrink vertically
|
|
||||||
bottomMargin: 3 // ""
|
bottomMargin: 3 // ""
|
||||||
|
leftMargin: 1 // Move it right
|
||||||
|
rightMargin: -1 // ""
|
||||||
}
|
}
|
||||||
radius: 3
|
radius: hifi.dimensions.scrollbarHandleWidth / 2
|
||||||
color: hifi.colors.tableScrollHandleDark
|
color: treeView.isLightColorScheme ? hifi.colors.tableScrollHandleLight : hifi.colors.tableScrollHandleDark
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollBarBackground: Item {
|
scrollBarBackground: Item {
|
||||||
implicitWidth: 9
|
implicitWidth: hifi.dimensions.scrollbarBackgroundWidth
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors {
|
anchors {
|
||||||
fill: parent
|
fill: parent
|
||||||
|
topMargin: treeView.headerVisible ? hifi.dimensions.tableHeaderHeight - 1 : -1
|
||||||
margins: -1 // Expand
|
margins: -1 // Expand
|
||||||
}
|
}
|
||||||
color: hifi.colors.tableBackgroundDark
|
color: treeView.isLightColorScheme ? hifi.colors.tableScrollBackgroundLight : hifi.colors.tableScrollBackgroundDark
|
||||||
|
|
||||||
|
// Extend header color above scrollbar background
|
||||||
|
Rectangle {
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
topMargin: -hifi.dimensions.tableHeaderHeight
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
height: hifi.dimensions.tableHeaderHeight
|
||||||
|
color: treeView.isLightColorScheme ? hifi.colors.tableBackgroundLight : hifi.colors.tableBackgroundDark
|
||||||
|
visible: treeView.headerVisible
|
||||||
|
}
|
||||||
|
Rectangle {
|
||||||
|
// Extend header bottom border
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
height: 1
|
||||||
|
color: treeView.isLightColorScheme ? hifi.colors.lightGrayText : hifi.colors.baseGrayHighlight
|
||||||
|
visible: treeView.headerVisible
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,6 +227,8 @@ TreeView {
|
||||||
color: colorScheme == hifi.colorSchemes.light
|
color: colorScheme == hifi.colorSchemes.light
|
||||||
? (styleData.selected ? hifi.colors.black : hifi.colors.baseGrayHighlight)
|
? (styleData.selected ? hifi.colors.black : hifi.colors.baseGrayHighlight)
|
||||||
: (styleData.selected ? hifi.colors.black : hifi.colors.lightGrayText)
|
: (styleData.selected ? hifi.colors.black : hifi.colors.lightGrayText)
|
||||||
|
|
||||||
|
elide: Text.ElideRight
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
|
|
|
@ -371,6 +371,10 @@ ScrollingWindow {
|
||||||
colorScheme: hifi.colorSchemes.dark
|
colorScheme: hifi.colorSchemes.dark
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
||||||
|
TableViewColumn {
|
||||||
|
role: "display";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HifiControls.VerticalSpacer {
|
HifiControls.VerticalSpacer {
|
||||||
|
|
|
@ -172,7 +172,7 @@ void AssetMappingsScriptingInterface::renameMapping(QString oldPath, QString new
|
||||||
}
|
}
|
||||||
|
|
||||||
AssetMappingModel::AssetMappingModel() {
|
AssetMappingModel::AssetMappingModel() {
|
||||||
setupHeaders();
|
setupRoles();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AssetMappingModel::isKnownFolder(QString path) const {
|
bool AssetMappingModel::isKnownFolder(QString path) const {
|
||||||
|
@ -288,6 +288,8 @@ void AssetMappingModel::refresh() {
|
||||||
emit errorGettingMappings(request->getErrorString());
|
emit errorGettingMappings(request->getErrorString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit updated();
|
||||||
|
|
||||||
request->deleteLater();
|
request->deleteLater();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -305,11 +307,9 @@ void AssetMappingModel::clear() {
|
||||||
|
|
||||||
_pathToItemMap.clear();
|
_pathToItemMap.clear();
|
||||||
QStandardItemModel::clear();
|
QStandardItemModel::clear();
|
||||||
setupHeaders(); // restore headers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssetMappingModel::setupHeaders() {
|
void AssetMappingModel::setupRoles() {
|
||||||
setHorizontalHeaderLabels(QStringList() << "Name" << "Use Baked?");
|
|
||||||
QHash<int, QByteArray> roleNames;
|
QHash<int, QByteArray> roleNames;
|
||||||
roleNames[Qt::DisplayRole] = "name";
|
roleNames[Qt::DisplayRole] = "name";
|
||||||
roleNames[Qt::UserRole + 5] = "baked";
|
roleNames[Qt::UserRole + 5] = "baked";
|
||||||
|
|
|
@ -38,9 +38,10 @@ public slots:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void errorGettingMappings(QString errorString);
|
void errorGettingMappings(QString errorString);
|
||||||
|
void updated();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupHeaders();
|
void setupRoles();
|
||||||
|
|
||||||
QHash<QString, QStandardItem*> _pathToItemMap;
|
QHash<QString, QStandardItem*> _pathToItemMap;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue