MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / update

Method update

src/qt/receiverequestdialog.cpp:125–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123}
124
125void ReceiveRequestDialog::update()
126{
127 if(!model)
128 return;
129 QString target = info.label;
130 if(target.isEmpty())
131 target = info.address;
132 setWindowTitle(tr("Request payment to %1").arg(target));
133
134 QString uri = GUIUtil::formatBitcoinURI(info);
135 ui->btnSaveAs->setEnabled(false);
136 QString html;
137 html += "<html><font face='verdana, arial, helvetica, sans-serif'>";
138 html += "<b>"+tr("Payment information")+"</b><br>";
139 html += "<b>"+tr("URI")+"</b>: ";
140 html += "<a href=\""+uri+"\">" + GUIUtil::HtmlEscape(uri) + "</a><br>";
141 html += "<b>"+tr("Address")+"</b>: " + GUIUtil::HtmlEscape(info.address) + "<br>";
142 if(info.amount)
143 html += "<b>"+tr("Amount")+"</b>: " + BitcoinUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), info.amount) + "<br>";
144 if(!info.label.isEmpty())
145 html += "<b>"+tr("Label")+"</b>: " + GUIUtil::HtmlEscape(info.label) + "<br>";
146 if(!info.message.isEmpty())
147 html += "<b>"+tr("Message")+"</b>: " + GUIUtil::HtmlEscape(info.message) + "<br>";
148 if(model->isMultiwallet()) {
149 html += "<b>"+tr("Wallet")+"</b>: " + GUIUtil::HtmlEscape(model->getWalletName()) + "<br>";
150 }
151 ui->outUri->setText(html);
152
153#ifdef USE_QRCODE
154 ui->lblQRCode->setText("");
155 if(!uri.isEmpty())
156 {
157 // limit URI length
158 if (uri.length() > MAX_URI_LENGTH)
159 {
160 ui->lblQRCode->setText(tr("Resulting URI too long, try to reduce the text for label / message."));
161 } else {
162 QRcode *code = QRcode_encodeString(uri.toUtf8().constData(), 0, QR_ECLEVEL_L, QR_MODE_8, 1);
163 if (!code)
164 {
165 ui->lblQRCode->setText(tr("Error encoding URI into QR Code."));
166 return;
167 }
168 QImage qrImage = QImage(code->width + 8, code->width + 8, QImage::Format_RGB32);
169 qrImage.fill(0xffffff);
170 unsigned char *p = code->data;
171 for (int y = 0; y < code->width; y++)
172 {
173 for (int x = 0; x < code->width; x++)
174 {
175 qrImage.setPixel(x + 4, y + 4, ((*p & 1) ? 0x0 : 0xffffff));
176 p++;
177 }
178 }
179 QRcode_free(code);
180
181 QImage qrAddrImage = QImage(QR_IMAGE_SIZE, QR_IMAGE_SIZE+20, QImage::Format_RGB32);
182 qrAddrImage.fill(0xffffff);

Callers 1

updateDisplayUnitMethod · 0.45

Calls 11

formatBitcoinURIFunction · 0.85
HtmlEscapeFunction · 0.85
fixedPitchFontFunction · 0.85
calculateIdealFontSizeFunction · 0.85
getDisplayUnitMethod · 0.80
isMultiwalletMethod · 0.80
fillMethod · 0.80
setEnabledMethod · 0.45
getOptionsModelMethod · 0.45
getWalletNameMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected