mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 20:48:56 +02:00
Cleaning up code and tweaking menu layout
This commit is contained in:
parent
10b5935063
commit
19ca543c2c
6 changed files with 128 additions and 1085 deletions
File diff suppressed because it is too large
Load diff
|
@ -325,7 +325,6 @@ Dialog {
|
||||||
|
|
||||||
case Qt.Key_Enter:
|
case Qt.Key_Enter:
|
||||||
case Qt.Key_Return:
|
case Qt.Key_Return:
|
||||||
console.log("Accepting");
|
|
||||||
event.accepted = true
|
event.accepted = true
|
||||||
content.accept()
|
content.accept()
|
||||||
break
|
break
|
||||||
|
|
115
interface/resources/qml/TestMenu.qml
Normal file
115
interface/resources/qml/TestMenu.qml
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
import QtQuick 2.4
|
||||||
|
import QtQuick.Controls 1.3
|
||||||
|
import Hifi 1.0
|
||||||
|
|
||||||
|
// Currently for testing a pure QML replacement menu
|
||||||
|
Item {
|
||||||
|
Item {
|
||||||
|
objectName: "AllActions"
|
||||||
|
Action {
|
||||||
|
id: aboutApp
|
||||||
|
objectName: "HifiAction_" + MenuConstants.AboutApp
|
||||||
|
text: qsTr("About Interface")
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// File Menu
|
||||||
|
//
|
||||||
|
Action {
|
||||||
|
id: login
|
||||||
|
objectName: "HifiAction_" + MenuConstants.Login
|
||||||
|
text: qsTr("Login")
|
||||||
|
}
|
||||||
|
Action {
|
||||||
|
id: quit
|
||||||
|
objectName: "HifiAction_" + MenuConstants.Quit
|
||||||
|
text: qsTr("Quit")
|
||||||
|
//shortcut: StandardKey.Quit
|
||||||
|
shortcut: "Ctrl+Q"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Edit menu
|
||||||
|
//
|
||||||
|
Action {
|
||||||
|
id: undo
|
||||||
|
text: "Undo"
|
||||||
|
shortcut: StandardKey.Undo
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: redo
|
||||||
|
text: "Redo"
|
||||||
|
shortcut: StandardKey.Redo
|
||||||
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
id: animations
|
||||||
|
objectName: "HifiAction_" + MenuConstants.Animations
|
||||||
|
text: qsTr("Animations...")
|
||||||
|
}
|
||||||
|
Action {
|
||||||
|
id: attachments
|
||||||
|
text: qsTr("Attachments...")
|
||||||
|
}
|
||||||
|
Action {
|
||||||
|
id: explode
|
||||||
|
text: qsTr("Explode on quit")
|
||||||
|
checkable: true
|
||||||
|
checked: true
|
||||||
|
}
|
||||||
|
Action {
|
||||||
|
id: freeze
|
||||||
|
text: qsTr("Freeze on quit")
|
||||||
|
checkable: true
|
||||||
|
checked: false
|
||||||
|
}
|
||||||
|
ExclusiveGroup {
|
||||||
|
Action {
|
||||||
|
id: visibleToEveryone
|
||||||
|
objectName: "HifiAction_" + MenuConstants.VisibleToEveryone
|
||||||
|
text: qsTr("Everyone")
|
||||||
|
checkable: true
|
||||||
|
checked: true
|
||||||
|
}
|
||||||
|
Action {
|
||||||
|
id: visibleToFriends
|
||||||
|
objectName: "HifiAction_" + MenuConstants.VisibleToFriends
|
||||||
|
text: qsTr("Friends")
|
||||||
|
checkable: true
|
||||||
|
}
|
||||||
|
Action {
|
||||||
|
id: visibleToNoOne
|
||||||
|
objectName: "HifiAction_" + MenuConstants.VisibleToNoOne
|
||||||
|
text: qsTr("No one")
|
||||||
|
checkable: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Menu {
|
||||||
|
objectName: "rootMenu";
|
||||||
|
Menu {
|
||||||
|
title: "File"
|
||||||
|
MenuItem { action: login }
|
||||||
|
MenuItem { action: explode }
|
||||||
|
MenuItem { action: freeze }
|
||||||
|
MenuItem { action: quit }
|
||||||
|
}
|
||||||
|
Menu {
|
||||||
|
title: "Tools"
|
||||||
|
Menu {
|
||||||
|
title: "I Am Visible To"
|
||||||
|
MenuItem { action: visibleToEveryone }
|
||||||
|
MenuItem { action: visibleToFriends }
|
||||||
|
MenuItem { action: visibleToNoOne }
|
||||||
|
}
|
||||||
|
MenuItem { action: animations }
|
||||||
|
}
|
||||||
|
Menu {
|
||||||
|
title: "Help"
|
||||||
|
MenuItem { action: aboutApp }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -128,13 +128,16 @@ Hifi.VrMenu {
|
||||||
// visible: source.visible
|
// visible: source.visible
|
||||||
Row {
|
Row {
|
||||||
id: row
|
id: row
|
||||||
spacing: 4
|
spacing: 2
|
||||||
anchors {
|
anchors {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
topMargin: 2
|
topMargin: 2
|
||||||
}
|
}
|
||||||
|
Spacer { size: 4 }
|
||||||
FontAwesome {
|
FontAwesome {
|
||||||
id: check
|
id: check
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
y: 2
|
||||||
size: label.height
|
size: label.height
|
||||||
text: checkText()
|
text: checkText()
|
||||||
color: label.color
|
color: label.color
|
||||||
|
@ -191,6 +194,7 @@ Hifi.VrMenu {
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
left: parent.left
|
left: parent.left
|
||||||
right: tag.right
|
right: tag.right
|
||||||
|
rightMargin: -4
|
||||||
}
|
}
|
||||||
acceptedButtons: Qt.LeftButton
|
acceptedButtons: Qt.LeftButton
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
@ -263,23 +267,22 @@ Hifi.VrMenu {
|
||||||
function popColumn() {
|
function popColumn() {
|
||||||
if (columns.length > 0) {
|
if (columns.length > 0) {
|
||||||
var curColumn = columns.pop();
|
var curColumn = columns.pop();
|
||||||
console.log(curColumn);
|
|
||||||
curColumn.visible = false;
|
curColumn.visible = false;
|
||||||
curColumn.destroy();
|
curColumn.destroy();
|
||||||
models.pop();
|
models.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (columns.length == 0) {
|
if (columns.length == 0) {
|
||||||
enabled = false;
|
enabled = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
curColumn = lastColumn();
|
curColumn = lastColumn();
|
||||||
curColumn.enabled = true;
|
curColumn.enabled = true;
|
||||||
curColumn.opacity = 1.0;
|
curColumn.opacity = 1.0;
|
||||||
curColumn.forceActiveFocus();
|
curColumn.forceActiveFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectItem(source) {
|
function selectItem(source) {
|
||||||
switch (source.type) {
|
switch (source.type) {
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -317,7 +320,7 @@ Hifi.VrMenu {
|
||||||
root.popColumn();
|
root.popColumn();
|
||||||
} else {
|
} else {
|
||||||
root.enabled = false;
|
root.enabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -426,7 +426,6 @@ void OffscreenUi::toggle(const QUrl& url, const QString& name, std::function<voi
|
||||||
item = _rootItem->findChild<QQuickItem*>(name);
|
item = _rootItem->findChild<QQuickItem*>(name);
|
||||||
}
|
}
|
||||||
if (item) {
|
if (item) {
|
||||||
qDebug() << "Turning item " << !item->isEnabled();
|
|
||||||
item->setEnabled(!item->isEnabled());
|
item->setEnabled(!item->isEnabled());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -348,7 +348,7 @@ public:
|
||||||
#else
|
#else
|
||||||
offscreenUi->setBaseUrl(QUrl::fromLocalFile(getQmlDir()));
|
offscreenUi->setBaseUrl(QUrl::fromLocalFile(getQmlDir()));
|
||||||
offscreenUi->load(QUrl("TestRoot.qml"));
|
offscreenUi->load(QUrl("TestRoot.qml"));
|
||||||
offscreenUi->load(QUrl("InterfaceMenu.qml"));
|
offscreenUi->load(QUrl("TestMenu.qml"));
|
||||||
// Requires a root menu to have been loaded before it can load
|
// Requires a root menu to have been loaded before it can load
|
||||||
VrMenu::load();
|
VrMenu::load();
|
||||||
#endif
|
#endif
|
||||||
|
@ -470,7 +470,7 @@ void QTestWindow::renderQml() {
|
||||||
|
|
||||||
|
|
||||||
const char * LOG_FILTER_RULES = R"V0G0N(
|
const char * LOG_FILTER_RULES = R"V0G0N(
|
||||||
*.debug=false
|
hifi.offscreen.focus.debug=false
|
||||||
qt.quick.mouse.debug=false
|
qt.quick.mouse.debug=false
|
||||||
)V0G0N";
|
)V0G0N";
|
||||||
|
|
||||||
|
@ -484,7 +484,7 @@ qt.quick.mouse.debug=false
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
// QLoggingCategory::setFilterRules(LOG_FILTER_RULES);
|
QLoggingCategory::setFilterRules(LOG_FILTER_RULES);
|
||||||
QTestWindow window;
|
QTestWindow window;
|
||||||
app.exec();
|
app.exec();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue