Cleaning up code and tweaking menu layout

This commit is contained in:
Brad Davis 2015-04-27 19:07:53 -07:00
parent 10b5935063
commit 19ca543c2c
6 changed files with 128 additions and 1085 deletions

File diff suppressed because it is too large Load diff

View file

@ -325,7 +325,6 @@ Dialog {
case Qt.Key_Enter:
case Qt.Key_Return:
console.log("Accepting");
event.accepted = true
content.accept()
break

View 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 }
}
}
}

View file

@ -128,13 +128,16 @@ Hifi.VrMenu {
// visible: source.visible
Row {
id: row
spacing: 4
spacing: 2
anchors {
top: parent.top
topMargin: 2
}
Spacer { size: 4 }
FontAwesome {
id: check
verticalAlignment: Text.AlignVCenter
y: 2
size: label.height
text: checkText()
color: label.color
@ -191,6 +194,7 @@ Hifi.VrMenu {
bottom: parent.bottom
left: parent.left
right: tag.right
rightMargin: -4
}
acceptedButtons: Qt.LeftButton
hoverEnabled: true
@ -263,23 +267,22 @@ Hifi.VrMenu {
function popColumn() {
if (columns.length > 0) {
var curColumn = columns.pop();
console.log(curColumn);
curColumn.visible = false;
curColumn.destroy();
models.pop();
}
}
if (columns.length == 0) {
enabled = false;
return;
}
}
curColumn = lastColumn();
curColumn.enabled = true;
curColumn.opacity = 1.0;
curColumn.forceActiveFocus();
}
function selectItem(source) {
switch (source.type) {
case 2:
@ -317,7 +320,7 @@ Hifi.VrMenu {
root.popColumn();
} else {
root.enabled = false;
}
}
}
}
}

View file

@ -426,7 +426,6 @@ void OffscreenUi::toggle(const QUrl& url, const QString& name, std::function<voi
item = _rootItem->findChild<QQuickItem*>(name);
}
if (item) {
qDebug() << "Turning item " << !item->isEnabled();
item->setEnabled(!item->isEnabled());
}
}

View file

@ -348,7 +348,7 @@ public:
#else
offscreenUi->setBaseUrl(QUrl::fromLocalFile(getQmlDir()));
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
VrMenu::load();
#endif
@ -470,7 +470,7 @@ void QTestWindow::renderQml() {
const char * LOG_FILTER_RULES = R"V0G0N(
*.debug=false
hifi.offscreen.focus.debug=false
qt.quick.mouse.debug=false
)V0G0N";
@ -484,7 +484,7 @@ qt.quick.mouse.debug=false
int main(int argc, char** argv) {
QGuiApplication app(argc, argv);
// QLoggingCategory::setFilterRules(LOG_FILTER_RULES);
QLoggingCategory::setFilterRules(LOG_FILTER_RULES);
QTestWindow window;
app.exec();
return 0;