Browse Source

ux improvements

cl-refactor
arkpar 10 years ago
parent
commit
1cd85e9cc9
  1. 2
      mix/main.cpp
  2. 215
      mix/qml/MainContent.qml
  3. 2
      mix/qml/ProjectList.qml
  4. 3
      mix/qml/ProjectModel.qml
  5. 2
      mix/qml/StateListModel.qml
  6. 2
      mix/qml/WebPreview.qml
  7. 1
      mix/qml/html/codeeditor.js
  8. 3
      mix/qml/js/ProjectModel.js
  9. 39
      mix/qml/main.qml

2
mix/main.cpp

@ -35,6 +35,8 @@ int main(int _argc, char* _argv[])
//work around ubuntu appmenu-qt5 bug
//https://bugs.launchpad.net/ubuntu/+source/appmenu-qt5/+bug/1323853
putenv((char*)"QT_QPA_PLATFORMTHEME=");
putenv((char*)"QSG_RENDER_LOOP=threaded");
putenv((char*)"QT_IM_MODULE=");
#endif
try
{

215
mix/qml/MainContent.qml

@ -23,14 +23,20 @@ Rectangle {
property alias rightViewVisible : rightView.visible
property alias webViewVisible : webPreview.visible
property alias projectViewVisible : projectList.visible
property alias runOnProjectLoad : mainSettings.runOnProjectLoad
property bool webViewHorizontal : codeWebSplitter.orientation === Qt.Vertical //vertical splitter positions elements vertically, splits screen horizontally
onWidthChanged:
{
if (rightView.visible)
contentView.width = parent.width - projectList.width - rightView.width;
else
contentView.width = parent.width - projectList.width;
property bool firstCompile: true
Connections {
target: codeModel
onCompilationComplete: {
if (firstCompile) {
firstCompile = false;
if (codeModel.code.successful && runOnProjectLoad)
startQuickDebugging();
}
}
}
function startQuickDebugging()
@ -40,15 +46,11 @@ Rectangle {
}
function toggleRightView() {
if (!rightView.visible)
rightView.show();
else
rightView.hide();
rightView.visible = !rightView.visible;
}
function ensureRightView() {
if (!rightView.visible)
rightView.show();
rightView.visible = true;
}
function rightViewIsVisible()
@ -65,6 +67,10 @@ Rectangle {
webPreview.visible = !webPreview.visible;
}
function toggleProjectView() {
projectList.visible = !projectList.visible;
}
function toggleWebPreviewOrientation() {
codeWebSplitter.orientation = (codeWebSplitter.orientation === Qt.Vertical ? Qt.Horizontal : Qt.Vertical);
}
@ -75,19 +81,18 @@ Rectangle {
}
Settings {
id: mainLayoutSettings
id: mainSettings
property alias codeWebOrientation: codeWebSplitter.orientation
property alias webWidth: webPreview.width
property alias webHeight: webPreview.height
property alias showProjectView: projectList.visible
property bool runOnProjectLoad: false
}
GridLayout
ColumnLayout
{
anchors.fill: parent
rows: 2
flow: GridLayout.TopToBottom
columnSpacing: 0
rowSpacing: 0
spacing: 0
Rectangle {
width: parent.width
height: 50
@ -128,116 +133,90 @@ Rectangle {
property alias rightViewWidth: rightView.width
}
ProjectList {
anchors.left: parent.left
id: projectList
width: 200
height: parent.height
Layout.minimumWidth: 200
}
Splitter
SplitView
{
id: resizeLeft
itemToStick: projectList
itemMinimumWidth: projectList.Layout.minimumWidth
direction: "right"
brother: contentView
color: "#a2a2a2"
}
Rectangle {
anchors.left: projectList.right
id: contentView
width: parent.width - projectList.width
height: parent.height
SplitView {
handleDelegate: Rectangle {
width: 4
height: 4
color: "#cccccc"
}
id: codeWebSplitter
anchors.fill: parent
orientation: Qt.Vertical
CodeEditorView {
height: parent.height * 0.6
anchors.top: parent.top
Layout.fillWidth: true
Layout.fillHeight: true
}
WebPreview {
id: webPreview
height: parent.height * 0.4
Layout.fillWidth: codeWebSplitter.orientation === Qt.Vertical
Layout.fillHeight: codeWebSplitter.orientation === Qt.Horizontal
Layout.minimumHeight: 200
Layout.minimumWidth: 200
}
anchors.fill: parent
handleDelegate: Rectangle {
width: 4
height: 4
color: "#cccccc"
}
}
Splitter
{
id: resizeRight
visible: false;
itemToStick: rightView
itemMinimumWidth: rightView.Layout.minimumWidth
direction: "left"
brother: contentView
color: "#a2a2a2"
}
Rectangle {
visible: false;
id: rightView;
orientation: Qt.Horizontal
Keys.onEscapePressed: hide()
function show() {
visible = true;
resizeRight.visible = true;
contentView.width = parent.width - projectList.width - rightView.width;
ProjectList {
id: projectList
width: 200
Layout.minimumWidth: 180
Layout.fillHeight: true
}
function hide() {
resizeRight.visible = false;
visible = false;
contentView.width = parent.width - projectList.width;
Rectangle {
id: contentView
Layout.fillHeight: true
Layout.fillWidth: true
SplitView {
handleDelegate: Rectangle {
width: 4
height: 4
color: "#cccccc"
}
id: codeWebSplitter
anchors.fill: parent
orientation: Qt.Vertical
CodeEditorView {
height: parent.height * 0.6
anchors.top: parent.top
Layout.fillWidth: true
Layout.fillHeight: true
}
WebPreview {
id: webPreview
height: parent.height * 0.4
Layout.fillWidth: codeWebSplitter.orientation === Qt.Vertical
Layout.fillHeight: codeWebSplitter.orientation === Qt.Horizontal
Layout.minimumHeight: 200
Layout.minimumWidth: 200
}
}
}
height: parent.height;
width: 515
Layout.minimumWidth: 515
anchors.right: parent.right
Rectangle {
anchors.fill: parent;
id: rightPaneView
TabView {
id: rightPaneTabs
tabsVisible: true
antialiasing: true
anchors.fill: parent
style: TabViewStyle {
frameOverlap: 1
tabBar:
Rectangle {
visible: false;
id: rightView;
Layout.fillHeight: true
Keys.onEscapePressed: visible = false
height: parent.height;
width: 515
Layout.minimumWidth: 515
anchors.right: parent.right
Rectangle {
anchors.fill: parent;
id: rightPaneView
TabView {
id: rightPaneTabs
tabsVisible: true
antialiasing: true
anchors.fill: parent
style: TabViewStyle {
frameOverlap: 1
tabBar:
Rectangle {
color: "#ededed"
id: background
}
tab: Rectangle {
color: "#ededed"
id: background
implicitWidth: 80
implicitHeight: 20
radius: 2
Text {
anchors.centerIn: parent
text: styleData.title
color: styleData.selected ? "#7da4cd" : "#202020"
}
}
tab: Rectangle {
color: "#ededed"
implicitWidth: 80
implicitHeight: 20
radius: 2
Text {
anchors.centerIn: parent
text: styleData.title
color: styleData.selected ? "#7da4cd" : "#202020"
frame: Rectangle {
}
}
frame: Rectangle {
}
}
}
}

2
mix/qml/ProjectList.qml

@ -3,7 +3,7 @@ import QtQuick.Window 2.0
import QtQuick.Layouts 1.0
import QtQuick.Controls 1.0
Item {
Rectangle {
property bool renameMode: false;
ColumnLayout {
anchors.fill: parent

3
mix/qml/ProjectModel.qml

@ -10,7 +10,8 @@ Item {
id: projectModel
signal projectClosed
signal projectLoaded(var projectData)
signal projectLoading(var projectData)
signal projectLoaded()
signal documentOpened(var document)
signal documentRemoved(var documentId)
signal documentUpdated(var documentId) //renamed

2
mix/qml/StateListModel.qml

@ -70,7 +70,7 @@ Item {
stateListModel.clear();
stateList = [];
}
onProjectLoaded: {
onProjectLoading: {
if (!projectData.states)
projectData.states = [];
if (projectData.defaultStateIndex !== undefined)

2
mix/qml/WebPreview.qml

@ -86,7 +86,7 @@ Item {
updateDocument(documentId, function(i) { pageListModel.set(i, projectModel.getDocument(documentId)) } )
}
onProjectLoaded: {
onProjectLoading: {
for (var i = 0; i < target.listModel.count; i++) {
var document = target.listModel.get(i);
if (document.isHtml) {

1
mix/qml/html/codeeditor.js

@ -31,6 +31,7 @@ getText = function() {
setTextBase64 = function(text) {
editor.setValue(window.atob(text));
editor.getDoc().clearHistory();
editor.focus();
};

3
mix/qml/js/ProjectModel.js

@ -73,7 +73,8 @@ function loadProject(path) {
addFile(projectData.files[i]);
}
projectSettings.lastProjectPath = path;
projectLoaded(projectData);
projectLoading(projectData);
projectLoaded()
}
function addExistingFile() {

39
mix/qml/main.qml

@ -36,14 +36,16 @@ ApplicationWindow {
Menu {
title: qsTr("Debug")
MenuItem { action: debugRunAction }
MenuItem { action: debugResetStateAction }
MenuItem { action: mineAction }
MenuSeparator {}
MenuItem { action: toggleRunOnLoadAction }
}
Menu {
title: qsTr("Windows")
MenuItem { action: openNextDocumentAction }
MenuItem { action: openPrevDocumentAction }
MenuSeparator {}
MenuItem { action: toggleProjectNavigatorAction }
MenuItem { action: showHideRightPanelAction }
MenuItem { action: toggleWebPreviewAction }
MenuItem { action: toggleWebPreviewOrientationAction }
@ -82,47 +84,58 @@ ApplicationWindow {
Action {
id: mineAction
text: "Mine"
text: qsTr("Mine")
shortcut: "Ctrl+M"
onTriggered: clientModel.mine();
enabled: codeModel.hasContract && !clientModel.running
}
Action {
id: debugRunAction
text: "&Run"
text: qsTr("Run")
shortcut: "F5"
onTriggered: mainContent.startQuickDebugging()
enabled: codeModel.hasContract && !clientModel.running
}
Action {
id: debugResetStateAction
text: "Reset &State"
shortcut: "F6"
onTriggered: clientModel.resetState();
}
Action {
id: toggleWebPreviewAction
text: "Show Web View"
text: qsTr("Show Web View")
shortcut: "F2"
checkable: true
checked: mainContent.webViewVisible
onTriggered: mainContent.toggleWebPreview();
}
Action {
id: toggleProjectNavigatorAction
text: qsTr("Show Project Navigator")
shortcut: "Alt+0"
checkable: true
checked: mainContent.projectViewVisible
onTriggered: mainContent.toggleProjectView();
}
Action {
id: toggleWebPreviewOrientationAction
text: "Horizontal Web View"
text: qsTr("Horizontal Web View")
shortcut: ""
checkable: true
checked: mainContent.webViewHorizontal
onTriggered: mainContent.toggleWebPreviewOrientation();
}
Action {
id: toggleRunOnLoadAction
text: qsTr("Load State on Startup")
shortcut: ""
checkable: true
checked: mainContent.runOnProjectLoad
onTriggered: mainContent.runOnProjectLoad = !mainContent.runOnProjectLoad
}
Action {
id: showHideRightPanelAction
text: "Show Right View"
text: qsTr("Show Right View")
shortcut: "F7"
checkable: true
checked: mainContent.rightViewVisible

Loading…
Cancel
Save