You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

203 lines
4.4 KiB

import QtQuick 2.2
import QtQuick.Controls 1.1
10 years ago
import QtQuick.Layouts 1.0
import QtQuick.Controls.Styles 1.1
10 years ago
import CodeEditorExtensionManager 1.0
import Qt.labs.settings 1.0
import org.ethereum.qml.QEther 1.0
import "js/QEtherHelper.js" as QEtherHelper
import "js/TransactionHelper.js" as TransactionHelper
10 years ago
import "."
10 years ago
Rectangle {
objectName: "mainContent"
signal keyPressed(variant event)
focus: true
Keys.enabled: true
Keys.onPressed:
{
root.keyPressed(event.key);
}
anchors.fill: parent
10 years ago
id: root
property alias rightViewVisible: rightView.visible
property alias webViewVisible: webPreview.visible
property alias projectViewVisible: projectList.visible
property alias runOnProjectLoad: mainSettings.runOnProjectLoad
property alias rightPane: rightView
property bool webViewHorizontal: codeWebSplitter.orientation === Qt.Vertical //vertical splitter positions elements vertically, splits screen horizontally
10 years ago
property bool firstCompile: true
Connections {
target: codeModel
onCompilationComplete: {
if (firstCompile) {
firstCompile = false;
if (runOnProjectLoad)
10 years ago
startQuickDebugging();
}
}
}
function startQuickDebugging()
{
10 years ago
ensureRightView();
projectModel.stateListModel.debugDefaultState();
}
function toggleRightView() {
10 years ago
rightView.visible = !rightView.visible;
}
function ensureRightView() {
10 years ago
rightView.visible = true;
10 years ago
}
function rightViewIsVisible()
{
return rightView.visible;
}
function hideRightView() {
rightView.visible = false;
10 years ago
}
function toggleWebPreview() {
webPreview.visible = !webPreview.visible;
}
10 years ago
function toggleProjectView() {
projectList.visible = !projectList.visible;
}
function toggleWebPreviewOrientation() {
codeWebSplitter.orientation = (codeWebSplitter.orientation === Qt.Vertical ? Qt.Horizontal : Qt.Vertical);
}
CodeEditorExtensionManager {
10 years ago
headerView: headerPaneTabs;
}
Settings {
10 years ago
id: mainSettings
property alias codeWebOrientation: codeWebSplitter.orientation
property alias webWidth: webPreview.width
property alias webHeight: webPreview.height
10 years ago
property alias showProjectView: projectList.visible
property bool runOnProjectLoad: true
}
10 years ago
ColumnLayout
10 years ago
{
anchors.fill: parent
10 years ago
spacing: 0
Rectangle {
width: parent.width
height: 50
10 years ago
Layout.row: 0
Layout.fillWidth: true
Layout.preferredHeight: 50
id: headerView
Rectangle
{
gradient: Gradient {
GradientStop { position: 0.0; color: "#f1f1f1" }
GradientStop { position: 1.0; color: "#d9d7da" }
}
id: headerPaneContainer
10 years ago
anchors.fill: parent
TabView {
id: headerPaneTabs
tabsVisible: false
antialiasing: true
anchors.fill: parent
style: TabViewStyle {
frameOverlap: 1
tab: Rectangle {}
frame: Rectangle { color: "transparent" }
}
}
}
}
10 years ago
10 years ago
Rectangle{
Layout.fillWidth: true
height: 1
color: "#8c8c8c"
}
Rectangle {
10 years ago
Layout.fillWidth: true
Layout.preferredHeight: root.height - headerView.height;
Settings {
id: splitSettings
property alias projectWidth: projectList.width
property alias contentViewWidth: contentView.width
property alias rightViewWidth: rightView.width
}
10 years ago
SplitView
{
10 years ago
anchors.fill: parent
handleDelegate: Rectangle {
10 years ago
width: 1
height: 1
color: "#8c8c8c"
}
10 years ago
orientation: Qt.Horizontal
10 years ago
10 years ago
ProjectList {
id: projectList
width: 350
Layout.minimumWidth: 250
10 years ago
Layout.fillHeight: true
}
10 years ago
Rectangle {
id: contentView
Layout.fillHeight: true
Layout.fillWidth: true
SplitView {
handleDelegate: Rectangle {
10 years ago
width: 1
height: 1
color: "#8c8c8c"
10 years ago
}
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
}
}
10 years ago
}
Debugger {
10 years ago
visible: false;
id: rightView;
Layout.fillHeight: true
Keys.onEscapePressed: visible = false
Layout.minimumWidth: 515
anchors.right: parent.right
}
}
}
}
10 years ago
}