Skip to content

Commit

Permalink
ui changes
Browse files Browse the repository at this point in the history
  • Loading branch information
yann300 committed Oct 12, 2015
1 parent cdc3bbc commit f42ec45
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 62 deletions.
78 changes: 28 additions & 50 deletions qml/Debugger.qml
Original file line number Diff line number Diff line change
Expand Up @@ -141,28 +141,36 @@ Rectangle {
text: qsTr("Current Transaction")
}

Rectangle
{
anchors.left: parent.left
anchors.leftMargin: 10
width: 40
DefaultButton {
anchors.right: parent.right
height: parent.height
color: "transparent"
anchors.verticalCenter: parent.verticalCenter
Image {
source: "qrc:/qml/img/leftarrowcircle.png"
width: parent.width
fillMode: Image.PreserveAspectFit
anchors.centerIn: parent
Component.onCompleted:
{
updateLabel()
}
MouseArea

function updateLabel()
{
anchors.fill: parent
onClicked:
{
Debugger.init(null);
panelClosed()
}
if (mainContent.debuggerPanel.assemblyMode)
text = qsTr("Solidity")
else
text = qsTr("VM")
}
onClicked:
{
mainContent.debuggerPanel.assemblyMode = !mainContent.debuggerPanel.assemblyMode;
updateLabel()
}
}

DefaultButton {
anchors.left: parent.left
height: parent.height
text: qsTr("Scenario View")
onClicked:
{
Debugger.init(null);
panelClosed()
}
}
}
Expand Down Expand Up @@ -362,37 +370,7 @@ Rectangle {
radius: 12
}
}
}

Rectangle
{
color: "transparent"
anchors.top: statesSlider.bottom
anchors.right: statesSlider.right
anchors.topMargin: 6
anchors.rightMargin: 33
height: 30
width: 50
DefaultButton {
Component.onCompleted:
{
updateLabel()
}

function updateLabel()
{
if (mainContent.debuggerPanel.assemblyMode)
text = qsTr("Solidity")
else
text = qsTr("VM")
}
onClicked:
{
mainContent.debuggerPanel.assemblyMode = !mainContent.debuggerPanel.assemblyMode;
updateLabel()
}
}
}
}
}
}
}
Expand Down
10 changes: 7 additions & 3 deletions qml/FilesSection.qml
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ Rectangle
onIsCleanChanged: {
if (groupName === sectionName && doc === documentId)
{
if (sectionName === "Contracts" && isClean)
if (sectionName === "Contracts" && isClean && codeModel.contracts[name])
codeConnection.hex = codeModel.contracts[name].codeHex + name
if (sectionName !== "Contracts" || isClean)
editStatusLabel.visible = !isClean;
Expand All @@ -234,9 +234,13 @@ Rectangle
return
editErrorStatusLabel.visible = false
editStatusLabel.visible = true
nameText.text = name
//we have to check in the document if the modified contract is this one.
var IsClean = hex === (codeModel.contracts[name].codeHex + name)
editStatusLabel.visible = !IsClean
if (codeModel.contracts[name])
{
var IsClean = hex === (codeModel.contracts[name].codeHex + name)
editStatusLabel.visible = !IsClean
}
}

onCompilationError:
Expand Down
45 changes: 41 additions & 4 deletions qml/ProjectList.qml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ Item {
anchors.left: parent.left
anchors.leftMargin: projectFilesStyle.general.leftMargin
font.family: srcSansProLight.name
font.weight: Font.Light
font.bold: true
font.wordSpacing: 2
}

DefaultText
Expand Down Expand Up @@ -147,6 +148,7 @@ Item {
{
found = true
ctr.startLocation = newLocation
sectionModel.set(k, ctr)
// we have a known contract at a different location
break;
}
Expand All @@ -159,6 +161,9 @@ Item {
}
}

//before, we delete duplicate (empty file) which lead to the same sol file.


if (!found)
{
var ctr = codeModel.contracts[name]
Expand All @@ -175,15 +180,47 @@ Item {
item.isText = doc.isText
item.path = doc.path
item.syntaxMode = doc.syntaxMode
sectionModel.append(item);

//we have a new contract, check if this contract has been created in an empty doc which already exist.
var emptyFileNotFound = true
for (var k = 0; k < sectionModel.count; k++)
{
var doc = sectionModel.get(k)
if (doc.name === qsTr("(empty)") && doc.documentId === codeModel.contracts[name].documentId)
{
if (emptyFileNotFound)
{
sectionModel.set(k, item);
emptyFileNotFound = false
break;
}
}
}
if (emptyFileNotFound)
sectionModel.append(item);
}
}
var toRename = {}

var alreadyEmpty = {}
for (var k = 0; k < sectionModel.count; k++)
{
var c = sectionModel.get(k)
if (!codeModel.contracts[c.name])
sectionModel.remove(k)
{
if (projectModel.codeEditor.getDocumentText(c.documentId).trim() !== "")
sectionModel.remove(k)
else
{
if (alreadyEmpty[c.documentId])
sectionModel.remove(k)
else
{
alreadyEmpty[c.documentId] = 1
c.name = qsTr("(empty)")
sectionModel.set(k, c)
}
}
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions qml/StatusPane.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Rectangle {
if (!message)
{
status.state = "";
status.text = qsTr("Compile successfully.");
status.text = qsTr("Compiled successfully.");
debugImg.state = "active";
currentStatus = { "type": "Comp", "date": Qt.formatDateTime(new Date(), "hh:mm:ss"), "content": status.text, "level": "info" }
}
Expand Down Expand Up @@ -96,7 +96,7 @@ Rectangle {
onRunStarted:
{
logPane.clear()
infoMessage(qsTr("Running transactions..."), "Run");
infoMessage(qsTr("Running transactions"), "Run");
}
onRunFailed: errorMessage(format(_message), "Run");
onRunComplete: infoMessage(qsTr("Run complete"), "Run");
Expand Down
2 changes: 2 additions & 0 deletions qml/Transaction.qml
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,8 @@ RowLayout
{
height: 35
spacing: 5
width: parent.width
layoutDirection: Qt.RightToLeft
CopyButton
{
anchors.verticalCenter: parent.verticalCenter
Expand Down
1 change: 0 additions & 1 deletion qml/TransactionDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ Dialog {
return (containerRect.width - 500) /2
}


RowLayout
{
Layout.preferredHeight: 55
Expand Down
2 changes: 1 addition & 1 deletion qml/WebPreview.qml
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ Item {
DefaultTextField {
id: expressionInput
width: parent.width - 15
height: 20
height: 23
font.family: webPreviewStyle.general.fontName
font.italic: true
anchors.verticalCenter: parent.verticalCenter
Expand Down
1 change: 0 additions & 1 deletion qml/js/ProjectModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ function openPrevDocument() {
if (doc.isContract)
{
currentContractIndex = Object.keys(codeModel.contracts).length - 1
console.log("prev " + currentContractIndex)
selectContractByIndex(currentContractIndex)
}
}
Expand Down

0 comments on commit f42ec45

Please sign in to comment.