filetransferinstance should use own pictures
@ -217,14 +217,16 @@ QString FileTransferInstance::getHtmlImage()
|
|||||||
QString res;
|
QString res;
|
||||||
if (state == tsPending || state == tsProcessing || state == tsPaused)
|
if (state == tsPending || state == tsProcessing || state == tsPaused)
|
||||||
{
|
{
|
||||||
QImage rightUp(":ui/stopFileButton/default.png");
|
QImage leftBtnImg(":/ui/fileTransferInstance/stopFileButton.png");
|
||||||
QImage rightDown;
|
QImage rightBtnImg;
|
||||||
if (state == tsProcessing)
|
if (state == tsProcessing)
|
||||||
rightDown = QImage(":ui/pauseFileButton/default.png");
|
rightBtnImg = QImage(":/ui/fileTransferInstance/pauseFileButton.png");
|
||||||
|
else if (state == tsPaused)
|
||||||
|
rightBtnImg = QImage(":/ui/fileTransferInstance/resumeFileButton.png");
|
||||||
else
|
else
|
||||||
rightDown = QImage(":ui/acceptFileButton/default.png");
|
rightBtnImg = QImage(":/ui/fileTransferInstance/acceptFileButton.png");
|
||||||
|
|
||||||
res = draw2ButtonsForm("green", rightUp, rightDown);
|
res = draw2ButtonsForm("green", leftBtnImg, rightBtnImg);
|
||||||
} else if (state == tsCanceled)
|
} else if (state == tsCanceled)
|
||||||
{
|
{
|
||||||
res = drawButtonlessForm("red");
|
res = drawButtonlessForm("red");
|
||||||
@ -262,16 +264,21 @@ void FileTransferInstance::pressFromHtml(QString code)
|
|||||||
|
|
||||||
QString FileTransferInstance::drawButtonlessForm(const QString &type)
|
QString FileTransferInstance::drawButtonlessForm(const QString &type)
|
||||||
{
|
{
|
||||||
QString res;
|
QString imgAStr;
|
||||||
|
QString imgBStr;
|
||||||
|
|
||||||
res = "<table widht=100% cellspacing=\"1\">\n<tr>\n";
|
if (type == "red")
|
||||||
res += insertMiniature();
|
{
|
||||||
res += "<td width=100%>\n";
|
imgAStr = "<img src=\"data:placeholder/png;base64," + QImage2base64(QImage(":/ui/fileTransferInstance/emptyLRedFileButton.png")) + "\">";
|
||||||
res += "<div class=" + type + "><p>" + filename + "</p><p>" + size + "</p></div>\n";
|
imgBStr = "<img src=\"data:placeholder/png;base64," + QImage2base64(QImage(":/ui/fileTransferInstance/emptyRRedFileButton.png")) + "\">";
|
||||||
res += "</td>\n</tr>\n";
|
} else {
|
||||||
res += "</table>\n";
|
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")) + "\">";
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
QString content = "<p>" + filename + "</p><p>" + size + "</p>";
|
||||||
|
|
||||||
|
return wrapIntoForm(content, type, imgAStr, imgBStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FileTransferInstance::insertMiniature()
|
QString FileTransferInstance::insertMiniature()
|
||||||
@ -290,12 +297,21 @@ QString FileTransferInstance::insertMiniature()
|
|||||||
|
|
||||||
QString FileTransferInstance::draw2ButtonsForm(const QString &type, const QImage &imgA, const QImage &imgB)
|
QString FileTransferInstance::draw2ButtonsForm(const QString &type, const QImage &imgA, const QImage &imgB)
|
||||||
{
|
{
|
||||||
QString res;
|
|
||||||
|
|
||||||
QString widgetId = QString::number(getId());
|
QString widgetId = QString::number(getId());
|
||||||
QString imgAstr = "<img src=\"data:ftrans." + widgetId + ".btnA/png;base64," + QImage2base64(imgA) + "\">";
|
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 imgBstr = "<img src=\"data:ftrans." + widgetId + ".btnB/png;base64," + QImage2base64(imgB) + "\">";
|
||||||
|
|
||||||
|
QString content;
|
||||||
|
content += "<p>" + filename + "</p>";
|
||||||
|
content += "<p>" + getHumanReadableSize(lastBytesSent) + " / " + size; + " (" + speed + ")</p>\n";
|
||||||
|
|
||||||
|
return wrapIntoForm(content, type, imgAstr, imgBstr);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString FileTransferInstance::wrapIntoForm(const QString& content, const QString &type, const QString &imgAstr, const QString &imgBstr)
|
||||||
|
{
|
||||||
|
QString res;
|
||||||
|
|
||||||
res = "<table widht=100% cellspacing=\"1\">\n";
|
res = "<table widht=100% cellspacing=\"1\">\n";
|
||||||
res += "<tr valign=middle>\n";
|
res += "<tr valign=middle>\n";
|
||||||
res += "<td>\n";
|
res += "<td>\n";
|
||||||
@ -304,8 +320,7 @@ QString FileTransferInstance::draw2ButtonsForm(const QString &type, const QImage
|
|||||||
res += insertMiniature();
|
res += insertMiniature();
|
||||||
res += "<td width=100%>\n";
|
res += "<td width=100%>\n";
|
||||||
res += "<div class=" + type + ">";
|
res += "<div class=" + type + ">";
|
||||||
res += "<p>" + filename + "</p>";
|
res += content;
|
||||||
res += "<p>" + getHumanReadableSize(lastBytesSent) + " / " + size; + " (" + speed + ")</p>\n";
|
|
||||||
res += "</div>\n";
|
res += "</div>\n";
|
||||||
res += "</td>\n";
|
res += "</td>\n";
|
||||||
res += "<td>\n";
|
res += "<td>\n";
|
||||||
|
@ -58,6 +58,7 @@ private:
|
|||||||
QString drawButtonlessForm(const QString &type);
|
QString drawButtonlessForm(const QString &type);
|
||||||
QString draw2ButtonsForm(const QString &type, const QImage &imgA, const QImage &imgB);
|
QString draw2ButtonsForm(const QString &type, const QImage &imgA, const QImage &imgB);
|
||||||
QString insertMiniature();
|
QString insertMiniature();
|
||||||
|
QString wrapIntoForm(const QString &content, const QString &type, const QString &imgAstr, const QString &imgBstr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum TransfState {tsPending, tsProcessing, tsPaused, tsFinished, tsCanceled};
|
enum TransfState {tsPending, tsProcessing, tsPaused, tsFinished, tsCanceled};
|
||||||
|
8
res.qrc
@ -126,5 +126,13 @@
|
|||||||
<file>ui/micButton/micButtonPressed.png</file>
|
<file>ui/micButton/micButtonPressed.png</file>
|
||||||
<file>ui/micButton/micButton.css</file>
|
<file>ui/micButton/micButton.css</file>
|
||||||
<file>ui/volButton/volButton.css</file>
|
<file>ui/volButton/volButton.css</file>
|
||||||
|
<file>ui/fileTransferInstance/acceptFileButton.png</file>
|
||||||
|
<file>ui/fileTransferInstance/pauseFileButton.png</file>
|
||||||
|
<file>ui/fileTransferInstance/resumeFileButton.png</file>
|
||||||
|
<file>ui/fileTransferInstance/stopFileButton.png</file>
|
||||||
|
<file>ui/fileTransferInstance/emptyLGreenFileButton.png</file>
|
||||||
|
<file>ui/fileTransferInstance/emptyLRedFileButton.png</file>
|
||||||
|
<file>ui/fileTransferInstance/emptyRGreenFileButton.png</file>
|
||||||
|
<file>ui/fileTransferInstance/emptyRRedFileButton.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -50,7 +50,6 @@ div.button {
|
|||||||
margin-bottom: 0px;
|
margin-bottom: 0px;
|
||||||
margin-left: 0px;
|
margin-left: 0px;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
background-color: #6bc260;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
div.red {
|
div.red {
|
||||||
|
BIN
ui/fileTransferInstance/acceptFileButton.png
Normal file
After Width: | Height: | Size: 490 B |
BIN
ui/fileTransferInstance/emptyLGreenFileButton.png
Normal file
After Width: | Height: | Size: 259 B |
BIN
ui/fileTransferInstance/emptyLRedFileButton.png
Normal file
After Width: | Height: | Size: 258 B |
BIN
ui/fileTransferInstance/emptyRGreenFileButton.png
Normal file
After Width: | Height: | Size: 270 B |
BIN
ui/fileTransferInstance/emptyRRedFileButton.png
Normal file
After Width: | Height: | Size: 268 B |
BIN
ui/fileTransferInstance/pauseFileButton.png
Normal file
After Width: | Height: | Size: 353 B |
BIN
ui/fileTransferInstance/resumeFileButton.png
Normal file
After Width: | Height: | Size: 273 B |
BIN
ui/fileTransferInstance/stopFileButton.png
Normal file
After Width: | Height: | Size: 557 B |