Browse Source

ui improvements

cl-refactor
yann300 10 years ago
committed by yann300
parent
commit
0085e600df
  1. 6
      mix/CodeModel.cpp
  2. 2
      mix/CodeModel.h
  3. 28
      mix/qml/FilesSection.qml
  4. 19
      mix/qml/MainContent.qml
  5. 43
      mix/qml/ProjectList.qml
  6. 10
      mix/qml/Style.qml
  7. BIN
      mix/qml/fonts/SourceSansPro-Black.ttf
  8. BIN
      mix/qml/fonts/SourceSansPro-BlackIt.ttf
  9. BIN
      mix/qml/fonts/SourceSansPro-Bold.ttf
  10. BIN
      mix/qml/fonts/SourceSansPro-BoldIt.ttf
  11. BIN
      mix/qml/fonts/SourceSansPro-ExtraLight.ttf
  12. BIN
      mix/qml/fonts/SourceSansPro-ExtraLightIt.ttf
  13. BIN
      mix/qml/fonts/SourceSansPro-It.ttf
  14. BIN
      mix/qml/fonts/SourceSansPro-Light.ttf
  15. BIN
      mix/qml/fonts/SourceSansPro-LightIt.ttf
  16. BIN
      mix/qml/fonts/SourceSansPro-Regular.ttf
  17. BIN
      mix/qml/fonts/SourceSansPro-Semibold.ttf
  18. BIN
      mix/qml/fonts/SourceSansPro-SemiboldIt.ttf
  19. BIN
      mix/qml/fonts/SourceSerifPro-Bold.ttf
  20. BIN
      mix/qml/fonts/SourceSerifPro-Regular.ttf
  21. BIN
      mix/qml/fonts/SourceSerifPro-Semibold.ttf
  22. BIN
      mix/qml/img/closedtriangleindicator_filesproject.png
  23. BIN
      mix/qml/img/opentriangleindicator_filesproject.png
  24. BIN
      mix/qml/img/projecticon.png
  25. 18
      mix/res.qrc

6
mix/CodeModel.cpp

@ -172,18 +172,12 @@ void CodeModel::onCompilationComplete(CompilationResult* _newResult)
m_compiling = false; m_compiling = false;
bool contractChanged = m_result->contractInterface() != _newResult->contractInterface(); bool contractChanged = m_result->contractInterface() != _newResult->contractInterface();
bool nameChanged = false;
if (m_result->successful())
nameChanged = !(m_result->sharedContract()->name() == _newResult->sharedContract()->name()); //@todo should manage multiple contracts.
m_result.reset(_newResult); m_result.reset(_newResult);
emit compilationComplete(); emit compilationComplete();
emit stateChanged(); emit stateChanged();
if (m_result->successful()) if (m_result->successful())
{ {
emit codeChanged(); emit codeChanged();
if (nameChanged)
emit contractNameChanged(_newResult->sharedContract()->name());
if (contractChanged) if (contractChanged)
emit contractInterfaceChanged(); emit contractInterfaceChanged();
} }

2
mix/CodeModel.h

@ -148,8 +148,6 @@ signals:
void contractInterfaceChanged(); void contractInterfaceChanged();
/// Emitted on compilation complete. Internal /// Emitted on compilation complete. Internal
void compilationCompleteInternal(CompilationResult* _newResult); void compilationCompleteInternal(CompilationResult* _newResult);
/// Emitted when the contract name has changed
void contractNameChanged(QString _newName);
private slots: private slots:
void onCompilationComplete(CompilationResult* _newResult); void onCompilationComplete(CompilationResult* _newResult);

28
mix/qml/FilesSection.qml

@ -20,17 +20,17 @@ ColumnLayout {
function hiddenHeightTopLevel() function hiddenHeightTopLevel()
{ {
return section.state === "hidden" ? Style.documentsList.height : Style.documentsList.height * (model.count + 1); return section.state === "hidden" ? Style.documentsList.height : Style.documentsList.fileNameHeight * model.count + Style.documentsList.height;
} }
function hiddenHeightRepeater() function hiddenHeightRepeater()
{ {
return section.state === "hidden" ? 0 : Style.documentsList.height * wrapperItem.model.count; return section.state === "hidden" ? 0 : Style.documentsList.fileNameHeight * wrapperItem.model.count;
} }
function hiddenHeightElement() function hiddenHeightElement()
{ {
return section.state === "hidden" ? 0 : Style.documentsList.height; return section.state === "hidden" ? 0 : Style.documentsList.fileNameHeight;
} }
function getDocumentIndex(documentId) function getDocumentIndex(documentId)
@ -48,6 +48,18 @@ ColumnLayout {
model.remove(i); model.remove(i);
} }
FontLoader
{
id: sectionTitleFont
source: "qrc:/qml/fonts/SourceSansPro-Bold.ttf"
}
FontLoader
{
id: fileNameFont
source: "qrc:/qml/fonts/SourceSansPro-Regular.ttf"
}
RowLayout RowLayout
{ {
anchors.top: parent.top anchors.top: parent.top
@ -56,12 +68,14 @@ ColumnLayout {
height: Style.documentsList.height height: Style.documentsList.height
Image { Image {
source: "qrc:/qml/img/opentriangleindicator.png" source: "qrc:/qml/img/opentriangleindicator_filesproject.png"
width: 15 width: 15
sourceSize.width: 15 sourceSize.width: 15
id: imgArrow id: imgArrow
anchors.right: section.left anchors.right: section.left
anchors.rightMargin: 5 anchors.rightMargin: 5
anchors.top: parent.top
anchors.topMargin: 8
} }
Text Text
@ -71,13 +85,14 @@ ColumnLayout {
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: Style.general.leftMargin anchors.leftMargin: Style.general.leftMargin
color: Style.documentsList.sectionColor color: Style.documentsList.sectionColor
font.bold: true font.family: sectionTitleFont.name
font.pointSize: Style.documentsList.fontSize
states: [ states: [
State { State {
name: "hidden" name: "hidden"
PropertyChanges { target: filesList; visible: false; } PropertyChanges { target: filesList; visible: false; }
PropertyChanges { target: rowCol; Layout.minimumHeight: Style.documentsList.height; Layout.maximumHeight: Style.documentsList.height; height: Style.documentsList.height; } PropertyChanges { target: rowCol; Layout.minimumHeight: Style.documentsList.height; Layout.maximumHeight: Style.documentsList.height; height: Style.documentsList.height; }
PropertyChanges { target: imgArrow; source: "qrc:/qml/img/closedtriangleindicator.png" } PropertyChanges { target: imgArrow; source: "qrc:/qml/img/closedtriangleindicator_filesproject.png" }
} }
] ]
} }
@ -126,6 +141,7 @@ ColumnLayout {
visible: !renameMode visible: !renameMode
color: rootItem.isSelected ? Style.documentsList.selectedColor : Style.documentsList.color color: rootItem.isSelected ? Style.documentsList.selectedColor : Style.documentsList.color
text: name; text: name;
font.family: fileNameFont.name
font.pointSize: Style.documentsList.fontSize font.pointSize: Style.documentsList.fontSize
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter

19
mix/qml/MainContent.qml

@ -7,6 +7,7 @@ import Qt.labs.settings 1.0
import org.ethereum.qml.QEther 1.0 import org.ethereum.qml.QEther 1.0
import "js/QEtherHelper.js" as QEtherHelper import "js/QEtherHelper.js" as QEtherHelper
import "js/TransactionHelper.js" as TransactionHelper import "js/TransactionHelper.js" as TransactionHelper
import "."
Rectangle { Rectangle {
@ -121,6 +122,12 @@ Rectangle {
} }
} }
Rectangle{
Layout.fillWidth: true
height: 1
color: "#8c8c8c"
}
Rectangle { Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: root.height - headerView.height; Layout.preferredHeight: root.height - headerView.height;
@ -136,9 +143,9 @@ Rectangle {
{ {
anchors.fill: parent anchors.fill: parent
handleDelegate: Rectangle { handleDelegate: Rectangle {
width: 4 width: 1
height: 4 height: 1
color: "#cccccc" color: "#8c8c8c"
} }
orientation: Qt.Horizontal orientation: Qt.Horizontal
@ -154,9 +161,9 @@ Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
SplitView { SplitView {
handleDelegate: Rectangle { handleDelegate: Rectangle {
width: 4 width: 1
height: 4 height: 1
color: "#cccccc" color: "#8c8c8c"
} }
id: codeWebSplitter id: codeWebSplitter
anchors.fill: parent anchors.fill: parent

43
mix/qml/ProjectList.qml

@ -12,19 +12,47 @@ Item {
anchors.fill: parent anchors.fill: parent
id: filesCol id: filesCol
spacing: 0 spacing: 0
FontLoader
{
id: srcSansProLight
source: "qrc:/qml/fonts/SourceSansPro-ExtraLight.ttf"
}
Rectangle Rectangle
{ {
color: Style.title.background color: Style.title.background
height: Style.title.height height: Style.title.height
Layout.fillWidth: true Layout.fillWidth: true
Image {
id: projectIcon
source: "qrc:/qml/img/projecticon.png"
sourceSize.height: 30
anchors.right: projectTitle.left
anchors.verticalCenter: parent.verticalCenter
anchors.rightMargin: 6
}
Text Text
{ {
id: projectTitle
color: Style.title.color color: Style.title.color
text: projectModel.projectTitle text: projectModel.projectTitle
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
visible: !projectModel.isEmpty; visible: !projectModel.isEmpty;
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: Style.general.leftMargin anchors.leftMargin: Style.general.leftMargin
font.family: srcSansProLight.name
font.pointSize: Style.title.pointSize
}
Text
{
text: "-"
anchors.right: parent.right
anchors.rightMargin: 15
font.family: srcSansProLight.name
font.pointSize: Style.title.pointSize
anchors.verticalCenter: parent.verticalCenter
} }
} }
@ -70,13 +98,16 @@ Item {
Connections { Connections {
target: codeModel target: codeModel
onContractNameChanged: { onCompilationComplete: {
if (modelData === "Contracts") if (modelData === "Contracts")
{ {
var ctr = projectModel.listModel.get(0); var ctr = projectModel.listModel.get(0);
ctr.name = _newName; if (codeModel.code.contract.name !== ctr.name)
projectModel.listModel.set(0, ctr); {
sectionModel.set(0, ctr); ctr.name = codeModel.code.contract.name;
projectModel.listModel.set(0, ctr);
sectionModel.set(0, ctr);
}
} }
} }
} }
@ -107,9 +138,9 @@ Item {
onDocumentAdded: onDocumentAdded:
{ {
var newDoc = projectModel.getDocumentIndex(documentId); var newDoc = projectModel.getDocument(documentId);
if (newDoc.groupName === modelData) if (newDoc.groupName === modelData)
ctrModel.append(newDoc); sectionModel.append(newDoc);
} }
} }
} }

10
mix/qml/Style.qml

@ -6,13 +6,14 @@ import QtQuick 2.0
*/ */
QtObject { QtObject {
property QtObject general: QtObject { property QtObject general: QtObject {
property int leftMargin: 30 property int leftMargin: 45
} }
property QtObject title: QtObject { property QtObject title: QtObject {
property string color: "#808080" property string color: "#808080"
property string background: "#f0f0f0" property string background: "#f0f0f0"
property int height: 40 property int height: 70
property int pointSize: 15
} }
property QtObject documentsList: QtObject { property QtObject documentsList: QtObject {
@ -21,7 +22,8 @@ QtObject {
property string sectionColor: "#808080" property string sectionColor: "#808080"
property string selectedColor: "white" property string selectedColor: "white"
property string highlightColor: "#4a90e2" property string highlightColor: "#4a90e2"
property int height: 30 property int height: 32
property int fontSize: 12 property int fileNameHeight: 45
property int fontSize: 15
} }
} }

BIN
mix/qml/fonts/SourceSansPro-Black.ttf

Binary file not shown.

BIN
mix/qml/fonts/SourceSansPro-BlackIt.ttf

Binary file not shown.

BIN
mix/qml/fonts/SourceSansPro-Bold.ttf

Binary file not shown.

BIN
mix/qml/fonts/SourceSansPro-BoldIt.ttf

Binary file not shown.

BIN
mix/qml/fonts/SourceSansPro-ExtraLight.ttf

Binary file not shown.

BIN
mix/qml/fonts/SourceSansPro-ExtraLightIt.ttf

Binary file not shown.

BIN
mix/qml/fonts/SourceSansPro-It.ttf

Binary file not shown.

BIN
mix/qml/fonts/SourceSansPro-Light.ttf

Binary file not shown.

BIN
mix/qml/fonts/SourceSansPro-LightIt.ttf

Binary file not shown.

BIN
mix/qml/fonts/SourceSansPro-Regular.ttf

Binary file not shown.

BIN
mix/qml/fonts/SourceSansPro-Semibold.ttf

Binary file not shown.

BIN
mix/qml/fonts/SourceSansPro-SemiboldIt.ttf

Binary file not shown.

BIN
mix/qml/fonts/SourceSerifPro-Bold.ttf

Binary file not shown.

BIN
mix/qml/fonts/SourceSerifPro-Regular.ttf

Binary file not shown.

BIN
mix/qml/fonts/SourceSerifPro-Semibold.ttf

Binary file not shown.

BIN
mix/qml/img/closedtriangleindicator_filesproject.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

BIN
mix/qml/img/opentriangleindicator_filesproject.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

BIN
mix/qml/img/projecticon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

18
mix/res.qrc

@ -66,5 +66,23 @@
<file>qml/Style.qml</file> <file>qml/Style.qml</file>
<file>qml/qmldir</file> <file>qml/qmldir</file>
<file>qml/FilesSection.qml</file> <file>qml/FilesSection.qml</file>
<file>qml/fonts/SourceSansPro-Black.ttf</file>
<file>qml/fonts/SourceSansPro-BlackIt.ttf</file>
<file>qml/fonts/SourceSansPro-Bold.ttf</file>
<file>qml/fonts/SourceSansPro-BoldIt.ttf</file>
<file>qml/fonts/SourceSansPro-ExtraLight.ttf</file>
<file>qml/fonts/SourceSansPro-ExtraLightIt.ttf</file>
<file>qml/fonts/SourceSansPro-It.ttf</file>
<file>qml/fonts/SourceSansPro-Light.ttf</file>
<file>qml/fonts/SourceSansPro-LightIt.ttf</file>
<file>qml/fonts/SourceSansPro-Regular.ttf</file>
<file>qml/fonts/SourceSansPro-Semibold.ttf</file>
<file>qml/fonts/SourceSansPro-SemiboldIt.ttf</file>
<file>qml/fonts/SourceSerifPro-Bold.ttf</file>
<file>qml/fonts/SourceSerifPro-Regular.ttf</file>
<file>qml/fonts/SourceSerifPro-Semibold.ttf</file>
<file>qml/img/closedtriangleindicator_filesproject.png</file>
<file>qml/img/opentriangleindicator_filesproject.png</file>
<file>qml/img/projecticon.png</file>
</qresource> </qresource>
</RCC> </RCC>

Loading…
Cancel
Save