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
auto localIter = contract->locals().find(LocationPair(instruction.getLocation().start, instruction.getLocation().end));
if (localIter != contract->locals().end())
{
solLocals[s.stack.size()] = new QVariableDeclaration(debugData, localIter.value().name.toStdString(), localIter.value().type);
}
}
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:
default:
break;
//BOOST_THROW_EXCEPTION(dev::Exception() << errinfo_comment("Unsupported solidityType: " + _type->toString()));
}
return r;
}

3
mix/QVariableDeclaration.cpp

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

4
mix/QVariableDeclaration.h

@ -37,6 +37,7 @@ namespace dev
namespace mix
{
/// UI wrapper around solidity type
class QSolidityType: public QObject
{
Q_OBJECT
@ -49,7 +50,7 @@ public:
QSolidityType() {}
QSolidityType(QObject* _parent, SolidityType const& _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,
UnsignedInteger,
@ -72,6 +73,7 @@ private:
SolidityType m_type;
};
/// UI wrapper around declaration (name + type)
class QVariableDeclaration: public QBasicNodeDefinition
{
Q_OBJECT

11
mix/SolidityType.h

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

2
mix/qml/StructView.qml

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

9
mix/qml/TransactionDialog.qml

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

2
mix/qml/VariablesView.qml

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

Loading…
Cancel
Save