QString FileTransferInstance::draw2ButtonsForm(const QString &type, const QImage &imgA, const QImage &imgB) { QString widgetId = QString::number(getId()); QString imgAstr = "<img src=\"data:ftrans." + widgetId + ".btnA/png;base64," + QImage2base64(imgA) + "\">"; QString imgBstr = "<img src=\"data:ftrans." + widgetId + ".btnB/png;base64," + QImage2base64(imgB) + "\">"; QString content; content += "<p>" + filename + "</p>"; content += "<p>" + getHumanReadableSize(lastBytesSent) + " / " + size + " (" + speed + " ETA: " + eta + ")</p>\n"; return wrapIntoForm(content, type, imgAstr, imgBstr); }
QString FileTransferInstance::drawButtonlessForm(const QString &type) { QString imgAStr; QString imgBStr; if (type == "red") { imgAStr = "<img src=\"data:placeholder/png;base64," + QImage2base64(QImage(":/ui/fileTransferInstance/emptyLRedFileButton.png")) + "\">"; imgBStr = "<img src=\"data:placeholder/png;base64," + QImage2base64(QImage(":/ui/fileTransferInstance/emptyRRedFileButton.png")) + "\">"; } else { imgAStr = "<img src=\"data:placeholder/png;base64," + QImage2base64(QImage(":/ui/fileTransferInstance/emptyLGreenFileButton.png")) + "\">"; imgBStr = "<img src=\"data:placeholder/png;base64," + QImage2base64(QImage(":/ui/fileTransferInstance/emptyRGreenFileButton.png")) + "\">"; } QString content = "<p>" + filenameElided + "</p><p>" + size + "</p>"; return wrapIntoForm(content, type, imgAStr, imgBStr); }
QString FileTransferInstance::draw2ButtonsForm(const QString &type, const QImage &imgA, const QImage &imgB) { QString widgetId = QString::number(getId()); QString imgAstr = "<img src=\"data:ftrans." + widgetId + ".btnA/png;base64," + QImage2base64(imgA) + "\">"; QString imgBstr = "<img src=\"data:ftrans." + widgetId + ".btnB/png;base64," + QImage2base64(imgB) + "\">"; QString content; QString progrBar = "<img src=\"data:progressbar." + widgetId + "/png;base64," + QImage2base64(drawProgressBarImg(double(lastBytesSent)/totalBytes, CONTENT_WIDTH, 9)) + "\">"; content = "<p>" + filenameElided + "</p>"; content += "<table cellspacing=\"0\"><tr>"; content += "<td>" + size + "</td>"; content += "<td align=center>" + speed + "</td>"; content += "<td align=right>ETA: " + eta + "</td>"; content += "</tr><tr><td colspan=3>"; content += progrBar; content += "</td></tr></table>"; return wrapIntoForm(content, type, imgAstr, imgBstr); }