Browse Source

style

cl-refactor
arkpar 10 years ago
parent
commit
6fd6d29662
  1. 2
      mix/ClientModel.cpp
  2. 1
      mix/CodeModel.cpp
  3. 3
      mix/QVariableDeclaration.cpp
  4. 4
      mix/QVariableDeclaration.h
  5. 11
      mix/SolidityType.h
  6. 2
      mix/qml/StructView.qml
  7. 9
      mix/qml/TransactionDialog.qml
  8. 2
      mix/qml/VariablesView.qml

2
mix/ClientModel.cpp

@ -355,9 +355,7 @@ void ClientModel::showDebuggerForTransaction(ExecutionResult const& _t)
//register new local variable initialization //register new local variable initialization
auto localIter = contract->locals().find(LocationPair(instruction.getLocation().start, instruction.getLocation().end)); auto localIter = contract->locals().find(LocationPair(instruction.getLocation().start, instruction.getLocation().end));
if (localIter != contract->locals().end()) if (localIter != contract->locals().end())
{
solLocals[s.stack.size()] = new QVariableDeclaration(debugData, localIter.value().name.toStdString(), localIter.value().type); solLocals[s.stack.size()] = new QVariableDeclaration(debugData, localIter.value().name.toStdString(), localIter.value().type);
}
} }
if (instruction.type() == dev::eth::Tag) if (instruction.type() == dev::eth::Tag)

1
mix/CodeModel.cpp

@ -371,7 +371,6 @@ SolidityType CodeModel::nodeType(solidity::Type const* _type)
case Type::Category::Void: case Type::Category::Void:
default: default:
break; break;
//BOOST_THROW_EXCEPTION(dev::Exception() << errinfo_comment("Unsupported solidityType: " + _type->toString()));
} }
return r; return r;
} }

3
mix/QVariableDeclaration.cpp

@ -14,8 +14,9 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>. along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
*/ */
/** @file QVariableDeclaration.h /** @file QVariableDeclaration.app
* @author Yann yann@ethdev.com * @author Yann yann@ethdev.com
* @author Arkadiy Paronyan arkadiy@ethdev.com
* @date 2015 * @date 2015
*/ */

4
mix/QVariableDeclaration.h

@ -37,6 +37,7 @@ namespace dev
namespace mix namespace mix
{ {
/// UI wrapper around solidity type
class QSolidityType: public QObject class QSolidityType: public QObject
{ {
Q_OBJECT Q_OBJECT
@ -49,7 +50,7 @@ public:
QSolidityType() {} QSolidityType() {}
QSolidityType(QObject* _parent, SolidityType const& _type); QSolidityType(QObject* _parent, SolidityType const& _type);
using Type = SolidityType::Type; using Type = SolidityType::Type;
enum QmlType //TODO: arrays and structs enum QmlType //TODO: Q_ENUMS does not support enum forwarding. Keep in sync with SolidityType::Type
{ {
SignedInteger, SignedInteger,
UnsignedInteger, UnsignedInteger,
@ -72,6 +73,7 @@ private:
SolidityType m_type; SolidityType m_type;
}; };
/// UI wrapper around declaration (name + type)
class QVariableDeclaration: public QBasicNodeDefinition class QVariableDeclaration: public QBasicNodeDefinition
{ {
Q_OBJECT Q_OBJECT

11
mix/SolidityType.h

@ -33,13 +33,14 @@ namespace mix
struct SolidityDeclaration; struct SolidityDeclaration;
//Type info extracted from solidity AST
struct SolidityType struct SolidityType
{ {
enum Type //TODO: arrays and structs enum Type //keep in sync with QSolidity::Type
{ {
SignedInteger, SignedInteger,
UnsignedInteger, UnsignedInteger,
Hash, Hash, //TODO: remove
Bool, Bool,
Address, Address,
Bytes, Bytes,
@ -47,12 +48,12 @@ struct SolidityType
Struct Struct
}; };
Type type; Type type;
unsigned size; //bytes, unsigned size; //in bytes,
bool array; bool array;
bool dynamicSize; bool dynamicSize;
QString name; QString name;
std::vector<SolidityDeclaration> members; std::vector<SolidityDeclaration> members; //for struct
std::vector<QString> enumNames; std::vector<QString> enumNames; //for enum
}; };
struct SolidityDeclaration struct SolidityDeclaration

2
mix/qml/StructView.qml

@ -8,7 +8,6 @@ Column
id: root id: root
property alias members: repeater.model //js array property alias members: repeater.model //js array
property var value : { x: "333" } property var value : { x: "333" }
property int level: 0
Layout.fillWidth: true Layout.fillWidth: true
Repeater Repeater
@ -65,7 +64,6 @@ Column
var pname = members[index].name; var pname = members[index].name;
var vals = value; var vals = value;
if (ptype.category === QSolidityType.Struct && !item.members) { if (ptype.category === QSolidityType.Struct && !item.members) {
item.level = level + 1;
item.value = getValue(); item.value = getValue();
item.members = ptype.members; item.members = ptype.members;
} }

9
mix/qml/TransactionDialog.qml

@ -11,7 +11,7 @@ Window {
id: modalTransactionDialog id: modalTransactionDialog
modality: Qt.ApplicationModal modality: Qt.ApplicationModal
width: 520 width: 520
height: 500;//(paramsModel.count > 0 ? 500 : 300) height: 500;
visible: false visible: false
color: StateDialogStyle.generic.backgroundColor color: StateDialogStyle.generic.backgroundColor
title: qsTr("Edit Transaction") title: qsTr("Edit Transaction")
@ -25,7 +25,6 @@ Window {
property var paramsModel: []; property var paramsModel: [];
property bool useTransactionDefaultValue: false property bool useTransactionDefaultValue: false
property alias stateAccounts: senderComboBox.model property alias stateAccounts: senderComboBox.model
signal accepted; signal accepted;
function open(index, item) { function open(index, item) {
@ -87,6 +86,9 @@ Window {
visible = true; visible = true;
valueField.focus = true; valueField.focus = true;
modalTransactionDialog.height = (paramsModel.length > 0 ? 500 : 300);
paramLabel.visible = paramsModel.length > 0;
paramScroll.visible = paramsModel.length > 0;
} }
function loadFunctions(contractId) function loadFunctions(contractId)
@ -326,16 +328,15 @@ Window {
id: paramLabel id: paramLabel
text: qsTr("Parameters:") text: qsTr("Parameters:")
Layout.preferredWidth: 75 Layout.preferredWidth: 75
visible: true;//paramsModel.length > 0
} }
ScrollView ScrollView
{ {
id: paramScroll
anchors.top: paramLabel.bottom anchors.top: paramLabel.bottom
anchors.topMargin: 10 anchors.topMargin: 10
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
visible: true;//paramsModel.length > 0
StructView StructView
{ {
id: typeLoader id: typeLoader

2
mix/qml/VariablesView.qml

@ -32,7 +32,7 @@ DebugInfoList
function setData(members, values) { function setData(members, values) {
storage.item.value = {}; storage.item.value = {};
storage.item.members = []; storage.item.members = [];
storage.item.value = values; storage.item.value = values; //TODO: use a signal for this?
storage.item.members = members; storage.item.members = members;
} }
} }

Loading…
Cancel
Save