10 QStackedWidget(parent),
49 scrollWidget->deleteLater();
52 if(
function.inputs.size() == 0)
58 QWidget *widgetParams =
new QWidget(
this);
59 widgetParams->setObjectName(
"scrollAreaWidgetContents");
61 QVBoxLayout *mainLayout =
new QVBoxLayout(widgetParams);
62 mainLayout->setSpacing(6);
63 mainLayout->setContentsMargins(0,0,30,0);
67 for(std::vector<ParameterABI>::const_iterator param =
function.inputs.begin(); param !=
function.inputs.end(); ++param)
69 QHBoxLayout *hLayout =
new QHBoxLayout();
70 hLayout->setSpacing(10);
71 hLayout->setContentsMargins(0,0,0,0);
72 QVBoxLayout *vNameLayout =
new QVBoxLayout();
73 vNameLayout->setSpacing(3);
74 vNameLayout->setContentsMargins(0,0,0,0);
75 QVBoxLayout *paramValuesLayout =
new QVBoxLayout();
76 paramValuesLayout->setSpacing(3);
77 paramValuesLayout->setContentsMargins(0,0,0,0);
79 QLabel *paramName =
new QLabel(
this);
80 paramName->setFixedWidth(160);
81 paramName->setFixedHeight(19);
82 QFontMetrics metrix(paramName->font());
83 int width = paramName->width() + 10;
84 QString text(QString(
"%2 <b>%1").arg(QString::fromStdString(param->name)).arg(QString::fromStdString(param->type)));
85 QString clippedText = metrix.elidedText(text, Qt::ElideRight, width);
86 paramName->setText(clippedText);
87 paramName->setToolTip(QString(
"%2 %1").arg(QString::fromStdString(param->name)).arg(QString::fromStdString(param->type)));
89 vNameLayout->addWidget(paramName);
90 hLayout->addLayout(vNameLayout);
91 QStringList listValues = paramValues[i];
92 if(listValues.size() > 0)
95 for(
int j = 0; j < listValues.count(); j++)
97 QLineEdit *paramValue =
new QLineEdit(
this);
98 paramValue->setReadOnly(
true);
99 paramValue->setText(listValues[j]);
100 paramValuesLayout->addWidget(paramValue);
105 vNameLayout->addSpacerItem(
new QSpacerItem(20, spacerSize, QSizePolicy::Fixed, QSizePolicy::Fixed));
107 hLayout->addLayout(paramValuesLayout);
111 hLayout->addSpacerItem(
new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Fixed));
114 mainLayout->addLayout(hLayout);
117 widgetParams->setLayout(mainLayout);
118 widgetParams->adjustSize();
119 if(widgetParams->sizeHint().height() < 70)
132 QVariantMap variantMap = result.toMap();
145 QVariantMap variantMap = result.toMap();
154 QVariantMap variantMap = result.toMap();
155 QVariantMap executionResultMap = variantMap.value(
"executionResult").toMap();
163 std::string rawData = executionResultMap.value(
"output").toString().toStdString();
164 std::vector<std::vector<std::string>> values;
165 std::vector<ParameterABI::ErrorType> errors;
166 if(
function.
abiOut(rawData, values, errors))
171 scrollWidget->deleteLater();
173 if(values.size() > 0)
175 QWidget *widgetResults =
new QWidget(
this);
176 widgetResults->setObjectName(
"scrollAreaWidgetContents");
178 QVBoxLayout *mainLayout =
new QVBoxLayout(widgetResults);
179 mainLayout->setSpacing(6);
180 mainLayout->setContentsMargins(0,6,0,6);
181 widgetResults->setLayout(mainLayout);
183 for(
size_t i = 0; i < values.size(); i++)
185 QHBoxLayout *hLayout =
new QHBoxLayout();
186 hLayout->setSpacing(10);
187 hLayout->setContentsMargins(0,0,0,0);
188 QVBoxLayout *vNameLayout =
new QVBoxLayout();
189 vNameLayout->setSpacing(3);
190 vNameLayout->setContentsMargins(0,0,0,0);
191 QVBoxLayout *paramValuesLayout =
new QVBoxLayout();
192 paramValuesLayout->setSpacing(3);
193 paramValuesLayout->setContentsMargins(0,0,0,0);
195 QLabel *resultName =
new QLabel(
this);
196 resultName->setFixedWidth(160);
197 resultName->setFixedHeight(19);
198 QFontMetrics metrix(resultName->font());
199 int width = resultName->width() + 10;
200 QString text(QString(
"%2 <b>%1").arg(QString::fromStdString(
function.outputs[i].
name)).arg(QString::fromStdString(
function.outputs[i].
type)));
201 QString clippedText = metrix.elidedText(text, Qt::ElideRight, width);
202 resultName->setText(clippedText);
203 resultName->setToolTip(QString(
"%2 %1").arg(QString::fromStdString(
function.outputs[i].name)).arg(QString::fromStdString(
function.outputs[i].type)));
205 vNameLayout->addWidget(resultName);
206 std::vector<std::string> listValues = values[i];
207 hLayout->addLayout(vNameLayout);
208 if(listValues.size() > 0)
211 for(
size_t j = 0; j < listValues.size(); j++)
213 QLineEdit *resultValue =
new QLineEdit(
this);
214 resultValue->setReadOnly(
true);
215 resultValue->setText(QString::fromStdString(listValues[j]));
216 paramValuesLayout->addWidget(resultValue);
221 vNameLayout->addSpacerItem(
new QSpacerItem(20, spacerSize, QSizePolicy::Fixed, QSizePolicy::Fixed));
222 hLayout->addLayout(paramValuesLayout);
226 hLayout->addSpacerItem(
new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Fixed));
228 mainLayout->addLayout(hLayout);
230 widgetResults->adjustSize();
231 if(widgetResults->sizeHint().height() < 70)
249 QString errorMessage;
250 errorMessage =
function.errorMessage(errors,
false);
251 QMessageBox::warning(
this, tr(
"Create contract"), errorMessage);
QLabel * labelContractAddress
QLineEdit * lineEditCallSenderAddress
void updateCreateResult(QVariant result)
QScrollArea * scrollAreaResult
QLineEdit * lineEditSenderAddress
void updateSendToResult(QVariant result)
void setResultData(QVariant result, FunctionABI function, QList< QStringList > paramValues, ContractTxType type)
QScrollArea * scrollAreaParams
QLineEdit * lineEditContractAddress
ContractResult(QWidget *parent=0)
T abiOut(bytes const &_data)
void updateCallResult(QVariant result, FunctionABI function, QList< QStringList > paramValues)
QLineEdit * lineEditHash160
QLineEdit * lineEditFunction
PlatformStyle::TableColorType type
QWidget * pageCreateOrSendToResult
QLineEdit * lineEditCallContractAddress
void setParamsData(FunctionABI function, QList< QStringList > paramValues)
QGroupBox * groupBoxResult
void setupUi(QStackedWidget *ContractResult)