mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Clean code
This commit is contained in:
parent
cd2e18f27b
commit
4642f2ab2a
@ -79,18 +79,7 @@ public slots:
|
|||||||
reader.setFileName(path);
|
reader.setFileName(path);
|
||||||
QImage image = reader.read();
|
QImage image = reader.read();
|
||||||
painter.drawImage(0, 0, image); // xi, yi is the position for imagei
|
painter.drawImage(0, 0, image); // xi, yi is the position for imagei
|
||||||
// if (counter == 0)
|
qDebug() << "Generating face Avatar from: " << (*j).toString(); // Print QVariant
|
||||||
// {
|
|
||||||
// base = QImage(bg.size(), QImage::Format_ARGB32_Premultiplied);
|
|
||||||
// qDebug() << "FIIIRST ";
|
|
||||||
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
|
|
||||||
// }
|
|
||||||
qDebug() << "iterating through QVariantList ";
|
|
||||||
qDebug() << (*j).toString(); // Print QVariant
|
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
painter.end();
|
painter.end();
|
||||||
@ -104,23 +93,9 @@ public slots:
|
|||||||
// Get Based 64 image string
|
// Get Based 64 image string
|
||||||
QString encoded = QString(ba.toBase64());
|
QString encoded = QString(ba.toBase64());
|
||||||
|
|
||||||
qDebug() << "@@@@@ encoded avatar " << encoded ;
|
|
||||||
|
|
||||||
return encoded;
|
return encoded;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage getImageFromPath (QString localPath)
|
|
||||||
{
|
|
||||||
qDebug() << "getImageFromPath() local path:" << localPath ;
|
|
||||||
|
|
||||||
// Read the image
|
|
||||||
QImageReader reader;
|
|
||||||
reader.setFileName(localPath);
|
|
||||||
QImage image = reader.read();
|
|
||||||
return image;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -16,7 +16,6 @@ Item
|
|||||||
id: imageAvatar
|
id: imageAvatar
|
||||||
width: height
|
width: height
|
||||||
height: iconSize
|
height: iconSize
|
||||||
visible: true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Canvas
|
// Canvas
|
||||||
@ -134,13 +133,9 @@ Item
|
|||||||
{
|
{
|
||||||
var url = src(gender, i, data[i+1])
|
var url = src(gender, i, data[i+1])
|
||||||
onloads.push(url)
|
onloads.push(url)
|
||||||
// canvasAvatar.loadImage(url)
|
|
||||||
}
|
}
|
||||||
// canvasAvatar.images = onloads
|
|
||||||
// canvasAvatar.callback = callback
|
|
||||||
var base64Image = androidImagePicker.faceImage(onloads, canvasSizes)
|
var base64Image = androidImagePicker.faceImage(onloads, canvasSizes)
|
||||||
callback("data:image/png;base64,"+base64Image)
|
callback("data:image/png;base64,"+base64Image)
|
||||||
// canvasAvatar.requestPaint()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the identicon
|
// Create the identicon
|
||||||
@ -148,30 +143,9 @@ Item
|
|||||||
{
|
{
|
||||||
var iconId = [dataHex, iconSize];
|
var iconId = [dataHex, iconSize];
|
||||||
var update = function(data)
|
var update = function(data)
|
||||||
{
|
|
||||||
// This conditions are for solve a bug on an Lg S3.
|
|
||||||
// On this device the toDataURL() is incompleted.
|
|
||||||
// So for see the complete avatar at least at first execution we'll show the canvas,
|
|
||||||
// instead of the image component.
|
|
||||||
// See issue: https://gitlab.com/angesoc/RetroShare/issues/37
|
|
||||||
if (facesCache.iconCache[iconId])
|
|
||||||
{
|
{
|
||||||
imageAvatar.source = data
|
imageAvatar.source = data
|
||||||
imageAvatar.visible = true
|
|
||||||
// canvasAvatar.visible = false
|
|
||||||
|
|
||||||
// canvasAvatar.height = 0
|
|
||||||
imageAvatar.height = iconSize
|
imageAvatar.height = iconSize
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// canvasAvatar.visible = true
|
|
||||||
imageAvatar.visible = false
|
|
||||||
|
|
||||||
// canvasAvatar.height = iconSize
|
|
||||||
imageAvatar.height = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
facesCache.iconCache[iconId] = data;
|
facesCache.iconCache[iconId] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user