Browse Source

- Add SourceSansPro*.qml

- Ui changes on state/transaction dialog
cl-refactor
yann300 10 years ago
parent
commit
6e5b352dc0
  1. 4
      mix/QEther.cpp
  2. 11
      mix/qml/Ether.qml
  3. 6
      mix/qml/FilesSection.qml
  4. 4
      mix/qml/ProjectList.qml
  5. 7
      mix/qml/QHashTypeView.qml
  6. 7
      mix/qml/QIntTypeView.qml
  7. 7
      mix/qml/QStringTypeView.qml
  8. 6
      mix/qml/SourceSansProBold.qml
  9. 7
      mix/qml/SourceSansProLight.qml
  10. 8
      mix/qml/SourceSansProRegular.qml
  11. 155
      mix/qml/StateDialog.qml
  12. 17
      mix/qml/StateDialogStyle.qml
  13. 294
      mix/qml/TransactionDialog.qml
  14. 1
      mix/qml/qmldir
  15. 4
      mix/res.qrc

4
mix/QEther.cpp

@ -35,7 +35,7 @@ QBigInt* QEther::toWei() const
const char* key = units.valueToKey(m_currentUnit); const char* key = units.valueToKey(m_currentUnit);
for (std::pair<dev::u256, std::string> rawUnit: dev::eth::units()) for (std::pair<dev::u256, std::string> rawUnit: dev::eth::units())
{ {
if (rawUnit.second == QString(key).toLower().toStdString()) if (QString::fromStdString(rawUnit.second).toLower() == QString(key).toLower())
return multiply(new QBigInt(rawUnit.first)); return multiply(new QBigInt(rawUnit.first));
} }
return new QBigInt(dev::u256(0)); return new QBigInt(dev::u256(0));
@ -46,7 +46,7 @@ void QEther::setUnit(QString const& _unit)
QMetaEnum units = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("EtherUnit")); QMetaEnum units = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("EtherUnit"));
for (int k = 0; k < units.keyCount(); k++) for (int k = 0; k < units.keyCount(); k++)
{ {
if (QString(units.key(k)).toLower() == _unit) if (QString(units.key(k)).toLower() == _unit.toLower())
{ {
m_currentUnit = static_cast<EtherUnit>(units.keysToValue(units.key(k))); m_currentUnit = static_cast<EtherUnit>(units.keysToValue(units.key(k)));
return; return;

11
mix/qml/Ether.qml

@ -32,6 +32,11 @@ RowLayout {
units.currentIndex = unit; units.currentIndex = unit;
} }
SourceSansProRegular
{
id: regularFont
}
TextField TextField
{ {
implicitWidth: 200 implicitWidth: 200
@ -46,6 +51,7 @@ RowLayout {
readOnly: !edit readOnly: !edit
visible: edit visible: edit
id: etherValueEdit; id: etherValueEdit;
font.family: regularFont.name
} }
ComboBox ComboBox
@ -81,10 +87,15 @@ RowLayout {
ListElement { text: "Kwei"; } ListElement { text: "Kwei"; }
ListElement { text: "wei"; } ListElement { text: "wei"; }
} }
style: ComboBoxStyle
{
font: regularFont.name
}
} }
Text Text
{ {
visible: displayFormattedValue visible: displayFormattedValue
id: formattedValue id: formattedValue
font.family: regularFont.name
} }
} }

6
mix/qml/FilesSection.qml

@ -48,16 +48,14 @@ ColumnLayout {
model.remove(i); model.remove(i);
} }
FontLoader SourceSansProRegular
{ {
id: fileNameFont id: fileNameFont
source: "qrc:/qml/fonts/SourceSansPro-Regular.ttf"
} }
FontLoader SourceSansProBold
{ {
id: boldFont id: boldFont
source: "qrc:/qml/fonts/SourceSansPro-Bold.ttf"
} }
RowLayout RowLayout

4
mix/qml/ProjectList.qml

@ -12,10 +12,10 @@ Item {
anchors.fill: parent anchors.fill: parent
id: filesCol id: filesCol
spacing: 0 spacing: 0
FontLoader
SourceSansProLight
{ {
id: srcSansProLight id: srcSansProLight
source: "qrc:/qml/fonts/SourceSansPro-Light.ttf"
} }
Rectangle Rectangle

7
mix/qml/QHashTypeView.qml

@ -4,6 +4,12 @@ Item
{ {
property alias text: textinput.text property alias text: textinput.text
id: editRoot id: editRoot
SourceSansProBold
{
id: boldFont
}
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
TextInput { TextInput {
@ -11,6 +17,7 @@ Item
text: text text: text
anchors.fill: parent anchors.fill: parent
wrapMode: Text.WrapAnywhere wrapMode: Text.WrapAnywhere
font.family: boldFont.name
MouseArea { MouseArea {
id: mouseArea id: mouseArea
anchors.fill: parent anchors.fill: parent

7
mix/qml/QIntTypeView.qml

@ -4,12 +4,19 @@ Item
{ {
property alias text: textinput.text property alias text: textinput.text
id: editRoot id: editRoot
SourceSansProBold
{
id: boldFont
}
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
TextInput { TextInput {
id: textinput id: textinput
text: text text: text
anchors.fill: parent anchors.fill: parent
font.family: boldFont.name
MouseArea { MouseArea {
id: mouseArea id: mouseArea
anchors.fill: parent anchors.fill: parent

7
mix/qml/QStringTypeView.qml

@ -4,6 +4,12 @@ Item
{ {
property alias text: textinput.text property alias text: textinput.text
id: editRoot id: editRoot
SourceSansProBold
{
id: boldFont
}
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
TextInput { TextInput {
@ -11,6 +17,7 @@ Item
text: text text: text
anchors.fill: parent anchors.fill: parent
wrapMode: Text.WrapAnywhere wrapMode: Text.WrapAnywhere
font.family: boldFont.name
MouseArea { MouseArea {
id: mouseArea id: mouseArea
anchors.fill: parent anchors.fill: parent

6
mix/qml/SourceSansProBold.qml

@ -0,0 +1,6 @@
import QtQuick 2.0
FontLoader
{
source: "qrc:/qml/fonts/SourceSansPro-Bold.ttf"
}

7
mix/qml/SourceSansProLight.qml

@ -0,0 +1,7 @@
import QtQuick 2.0
FontLoader
{
source: "qrc:/qml/fonts/SourceSansPro-Light.ttf"
}

8
mix/qml/SourceSansProRegular.qml

@ -0,0 +1,8 @@
import QtQuick 2.0
FontLoader
{
source: "qrc:/qml/fonts/SourceSansPro-Regular.ttf"
}

155
mix/qml/StateDialog.qml

@ -2,9 +2,11 @@ import QtQuick 2.2
import QtQuick.Controls 1.1 import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Window 2.0 import QtQuick.Window 2.0
import QtQuick.Controls.Styles 1.3
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 "."
Window { Window {
id: modalStateDialog id: modalStateDialog
@ -14,6 +16,7 @@ Window {
height: 480 height: 480
visible: false visible: false
color: StateDialogStyle.generic.backgroundColor
property alias stateTitle: titleField.text property alias stateTitle: titleField.text
property alias stateBalance: balanceField.value property alias stateBalance: balanceField.value
@ -53,59 +56,96 @@ Window {
return item; return item;
} }
GridLayout { SourceSansProRegular
id: dialogContent {
columns: 2 id: regularFont
}
Rectangle
{
anchors.fill: parent anchors.fill: parent
anchors.margins: 10 anchors.margins: 10
rowSpacing: 10 color: StateDialogStyle.generic.backgroundColor
columnSpacing: 10 GridLayout {
id: dialogContent
columns: 2
anchors.top: parent.top
rowSpacing: 10
columnSpacing: 10
Label { Label {
text: qsTr("Title") text: qsTr("Title")
} font.family: regularFont.name
TextField { color: "#808080"
id: titleField }
focus: true TextField {
Layout.fillWidth: true id: titleField
} focus: true
Layout.fillWidth: true
font.family: regularFont.name
}
Label { Label {
text: qsTr("Balance") text: qsTr("Balance")
} font.family: regularFont.name
Ether { color: "#808080"
id: balanceField }
edit: true Ether {
displayFormattedValue: true id: balanceField
Layout.fillWidth: true edit: true
} displayFormattedValue: true
Layout.fillWidth: true
}
Label { Label {
text: qsTr("Default") text: qsTr("Default")
} font.family: regularFont.name
CheckBox { color: "#808080"
id: defaultCheckBox }
Layout.fillWidth: true CheckBox {
id: defaultCheckBox
Layout.fillWidth: true
}
} }
Label { ColumnLayout
text: qsTr("Transactions") {
} width: parent.width
ListView { anchors.top: dialogContent.bottom
Layout.fillWidth: true anchors.topMargin: 5
Layout.fillHeight: true spacing: 5
model: transactionsModel Label {
delegate: transactionRenderDelegate text: qsTr("Transactions")
} font.family: regularFont.name
color: "#808080"
}
Label { ListView {
id: trList
Layout.preferredWidth: 200
Layout.fillHeight: true
Layout.minimumHeight: 20 * transactionsModel.count
model: transactionsModel
delegate: transactionRenderDelegate
visible: transactionsModel.count > 0
}
ToolButton {
onClicked: transactionsModel.addTransaction()
style: ButtonStyle
{
label: Text {
font.family: regularFont.name
text: qsTr("+")
font.pointSize: 20
color: "#808080"
}
background: Rectangle {
color: "transparent"
}
}
}
} }
Button {
text: qsTr("Add")
onClicked: transactionsModel.addTransaction()
}
}
RowLayout { RowLayout {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
@ -123,6 +163,10 @@ Window {
onClicked: close(); onClicked: close();
} }
} }
}
ListModel { ListModel {
id: transactionsModel id: transactionsModel
@ -160,18 +204,43 @@ Window {
text: functionId text: functionId
font.pointSize: 12 font.pointSize: 12
verticalAlignment: Text.AlignBottom verticalAlignment: Text.AlignBottom
font.family: regularFont.name
} }
ToolButton { ToolButton {
text: qsTr("Edit"); text: qsTr("Edit");
visible: !stdContract visible: !stdContract
Layout.fillHeight: true Layout.fillHeight: true
onClicked: transactionsModel.editTransaction(index) onClicked: transactionsModel.editTransaction(index)
style: ButtonStyle
{
label: Text {
font.family: regularFont.name
text: qsTr("Edit")
font.italic: true
font.pointSize: 9
}
background: Rectangle {
color: "transparent"
}
}
} }
ToolButton { ToolButton {
visible: index >= 0 ? !transactionsModel.get(index).executeConstructor : false visible: index >= 0 ? !transactionsModel.get(index).executeConstructor : false
text: qsTr("Delete"); text: qsTr("Delete");
Layout.fillHeight: true Layout.fillHeight: true
onClicked: transactionsModel.deleteTransaction(index) onClicked: transactionsModel.deleteTransaction(index)
style: ButtonStyle
{
label: Text {
font.family: regularFont.name
text: qsTr("Delete")
font.italic: true
font.pointSize: 9
}
background: Rectangle {
color: "transparent"
}
}
} }
} }
} }

17
mix/qml/StateDialogStyle.qml

@ -0,0 +1,17 @@
pragma Singleton
import QtQuick 2.0
QtObject {
property QtObject generic: QtObject
{
property string backgroundColor: "#ededed"
}
property QtObject stateDialog: QtObject
{
}
property QtObject transactionDialog: QtObject
{
}
}

294
mix/qml/TransactionDialog.qml

@ -2,15 +2,18 @@ import QtQuick 2.2
import QtQuick.Controls 1.1 import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Window 2.0 import QtQuick.Window 2.0
import QtQuick.Controls.Styles 1.3
import org.ethereum.qml.QEther 1.0 import org.ethereum.qml.QEther 1.0
import "js/TransactionHelper.js" as TransactionHelper import "js/TransactionHelper.js" as TransactionHelper
import "."
Window { Window {
id: modalTransactionDialog id: modalTransactionDialog
modality: Qt.WindowModal modality: Qt.WindowModal
width:640 width: 640
height:640 height: 700
visible: false visible: false
color: StateDialogStyle.generic.backgroundColor
property int transactionIndex property int transactionIndex
property alias transactionParams: paramsModel; property alias transactionParams: paramsModel;
@ -155,11 +158,17 @@ Window {
return item; return item;
} }
SourceSansProRegular
{
id: regularFont
}
ColumnLayout { ColumnLayout {
id: dialogContent id: dialogContent
width: parent.width width: parent.width
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top
anchors.margins: 10 anchors.margins: 10
spacing: 30 spacing: 30
RowLayout RowLayout
@ -170,10 +179,12 @@ Window {
Label { Label {
Layout.preferredWidth: 75 Layout.preferredWidth: 75
text: qsTr("Function") text: qsTr("Function")
font.family: regularFont.name
color: "#808080"
} }
ComboBox { ComboBox {
id: functionComboBox id: functionComboBox
Layout.fillWidth: true Layout.preferredWidth: 350
currentIndex: -1 currentIndex: -1
textRole: "text" textRole: "text"
editable: false editable: false
@ -183,6 +194,10 @@ Window {
onCurrentIndexChanged: { onCurrentIndexChanged: {
loadParameters(); loadParameters();
} }
style: ComboBoxStyle
{
font: regularFont.name
}
} }
} }
@ -191,18 +206,17 @@ Window {
{ {
id: rowValue id: rowValue
Layout.fillWidth: true Layout.fillWidth: true
height: 150
Label { Label {
Layout.preferredWidth: 75 Layout.preferredWidth: 75
text: qsTr("Value") text: qsTr("Value")
font.family: regularFont.name
color: "#808080"
} }
Rectangle Ether {
{ id: valueField
Layout.fillWidth: true edit: true
Ether { displayFormattedValue: true
id: valueField
edit: true
displayFormattedValue: true
}
} }
} }
@ -211,18 +225,17 @@ Window {
{ {
id: rowGas id: rowGas
Layout.fillWidth: true Layout.fillWidth: true
height: 150
Label { Label {
Layout.preferredWidth: 75 Layout.preferredWidth: 75
text: qsTr("Gas") text: qsTr("Gas")
font.family: regularFont.name
color: "#808080"
} }
Rectangle Ether {
{ id: gasField
Layout.fillWidth: true edit: true
Ether { displayFormattedValue: true
id: gasField
edit: true
displayFormattedValue: true
}
} }
} }
@ -230,31 +243,153 @@ Window {
{ {
id: rowGasPrice id: rowGasPrice
Layout.fillWidth: true Layout.fillWidth: true
height: 150
Label { Label {
Layout.preferredWidth: 75 Layout.preferredWidth: 75
text: qsTr("Gas Price") text: qsTr("Gas Price")
font.family: regularFont.name
color: "#808080"
} }
Rectangle Ether {
{ id: gasPriceField
Layout.fillWidth: true edit: true
Ether { displayFormattedValue: true
id: gasPriceField
edit: true
displayFormattedValue: true
}
} }
} }
RowLayout //ColumnLayout
{ //{
Layout.fillWidth: true //Layout.fillHeight: true;
Label { //Layout.fillWidth: true;
text: qsTr("Parameters") //visible: paramsModel.count > 0
Layout.preferredWidth: 75
} Label {
TableView { text: qsTr("Parameters")
Layout.preferredWidth: 75
font.family: regularFont.name
color: "#808080"
visible: paramsModel.count > 0
}
Repeater
{
model: paramsModel
visible: paramsModel.count > 0
Rectangle
{
color: "transparent"
Layout.fillWidth: true
height: 150
Label {
id: typeLabel
text: type
}
Label {
anchors.left: typeLabel.right
id: nameLabel
text: name
}
Label {
anchors.left: nameLabel.right
id: equalLabel
text: "="
}
Loader
{
anchors.left: equalLabel.right
id: typeLoader
height: 50
width: 150
Connections {
target: typeLoader.item
onTextChanged: {
console.log("text changed 0 " + value);
value = typeLoader.item.text;
console.log("text changed 1 " + value);
}
}
sourceComponent:
{
console.log(type);
if (type.indexOf("int") !== -1)
return intViewComp;
else if (type.indexOf("bool") !== -1)
return boolViewComp;
else if (type.indexOf("string") !== -1)
return stringViewComp;
else if (type.indexOf("hash") !== -1)
return hashViewComp;
else
return null;
}
Component
{
id: intViewComp
QIntTypeView
{
height: 50
width: 150
id: intView
text: value
}
}
Component
{
id: boolViewComp
QBoolTypeView
{
height: 50
width: 150
id: boolView
defaultValue: "1"
Component.onCompleted:
{
/*loaderEditor.updateValue(styleData.row, styleData.role,
(paramsModel.get(styleData.row).value === "" ? defaultValue :
paramsModel.get(styleData.row).value));
text = (paramsModel.get(styleData.row).value === "" ? defaultValue : paramsModel.get(styleData.row).value);*/
}
}
}
Component
{
id: stringViewComp
QStringTypeView
{
height: 50
width: 150
id: stringView
text: value
}
}
Component
{
id: hashViewComp
QHashTypeView
{
height: 50
width: 150
id: hashView
text: value
}
}
}
}
}
//}
/*TableView {
model: paramsModel model: paramsModel
Layout.preferredWidth: 120 * 2 + 240 Layout.fillWidth: true
Layout.minimumHeight: 150 Layout.minimumHeight: 150
Layout.preferredHeight: 400 Layout.preferredHeight: 400
Layout.maximumHeight: 600 Layout.maximumHeight: 600
@ -276,27 +411,26 @@ Window {
rowDelegate: rowDelegate rowDelegate: rowDelegate
itemDelegate: editableDelegate itemDelegate: editableDelegate
} }*/
} }
}
RowLayout RowLayout
{ {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.right: parent.right; anchors.right: parent.right;
Button { Button {
text: qsTr("OK"); text: qsTr("OK");
onClicked: { onClicked: {
close(); close();
accepted(); accepted();
}
}
Button {
text: qsTr("Cancel");
onClicked: close();
} }
} }
Button {
text: qsTr("Cancel");
onClicked: close();
}
}
ListModel { ListModel {
@ -332,6 +466,7 @@ Window {
sourceComponent: sourceComponent:
{ {
console.log("role " + styleData.role);
if (styleData.role === "value") if (styleData.role === "value")
{ {
if (paramsModel.get(styleData.row) === undefined) if (paramsModel.get(styleData.row) === undefined)
@ -349,53 +484,7 @@ Window {
return editor; return editor;
} }
Component
{
id: intViewComp
QIntTypeView
{
id: intView
text: styleData.value
}
}
Component
{
id: boolViewComp
QBoolTypeView
{
id: boolView
defaultValue: "1"
Component.onCompleted:
{
loaderEditor.updateValue(styleData.row, styleData.role,
(paramsModel.get(styleData.row).value === "" ? defaultValue :
paramsModel.get(styleData.row).value));
text = (paramsModel.get(styleData.row).value === "" ? defaultValue : paramsModel.get(styleData.row).value);
}
}
}
Component
{
id: stringViewComp
QStringTypeView
{
id: stringView
text: styleData.value
}
}
Component
{
id: hashViewComp
QHashTypeView
{
id: hashView
text: styleData.value
}
}
Component { Component {
id: editor id: editor
@ -404,12 +493,7 @@ Window {
readOnly: true readOnly: true
color: styleData.textColor color: styleData.textColor
text: styleData.value text: styleData.value
MouseArea { font.family: regularFont.name
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: textinput.forceActiveFocus()
}
} }
} }
} }

1
mix/qml/qmldir

@ -1 +1,2 @@
singleton Style 1.0 Style.qml singleton Style 1.0 Style.qml
singleton StateDialogStyle 1.0 StateDialogStyle.qml

4
mix/res.qrc

@ -83,5 +83,9 @@
<file>qml/img/closedtriangleindicator_filesproject.png</file> <file>qml/img/closedtriangleindicator_filesproject.png</file>
<file>qml/img/opentriangleindicator_filesproject.png</file> <file>qml/img/opentriangleindicator_filesproject.png</file>
<file>qml/img/projecticon.png</file> <file>qml/img/projecticon.png</file>
<file>qml/SourceSansProRegular.qml</file>
<file>qml/SourceSansProBold.qml</file>
<file>qml/SourceSansProLight.qml</file>
<file>qml/StateDialogStyle.qml</file>
</qresource> </qresource>
</RCC> </RCC>

Loading…
Cancel
Save