store Avatar images as PNG format, to not lose the transparent of the pictures

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1609 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2009-09-07 13:59:38 +00:00
parent 5bcaa270ca
commit 758ba49ff1
4 changed files with 17 additions and 20 deletions

View File

@ -559,8 +559,8 @@ void MessengerWindow::updateAvatar()
// set the image
QPixmap pix ;
pix.loadFromData(data,size,"JPG") ;
ui.avatarButton->setIcon(pix); // writes image into ba in JPG format
pix.loadFromData(data,size,"PNG") ;
ui.avatarButton->setIcon(pix); // writes image into ba in PNG format
delete[] data ;
}
@ -578,7 +578,7 @@ void MessengerWindow::getAvatar()
QByteArray ba;
QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly);
picture.save(&buffer, "JPG"); // writes image into ba in JPG format
picture.save(&buffer, "PNG"); // writes image into ba in PNG format
std::cerr << "Image size = " << ba.size() << std::endl ;

View File

@ -1207,8 +1207,8 @@ void PeersDialog::updateAvatar()
// set the image
QPixmap pix ;
pix.loadFromData(data,size,"JPG") ;
ui.avatartoolButton->setIcon(pix); // writes image into ba in JPG format
pix.loadFromData(data,size,"PNG") ;
ui.avatartoolButton->setIcon(pix); // writes image into ba in PNG format
delete[] data ;
}
@ -1226,7 +1226,7 @@ void PeersDialog::getAvatar()
QByteArray ba;
QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly);
picture.save(&buffer, "JPG"); // writes image into ba in JPG format
picture.save(&buffer, "PNG"); // writes image into ba in PNG format
std::cerr << "Image size = " << ba.size() << std::endl ;

View File

@ -102,9 +102,6 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
QString title = QString::fromStdString(name) + " :" + tr(" RetroShare - Encrypted Chat") ;
setWindowTitle(title);
//set the default avatar
//ui.avatarlabel->setPixmap(QPixmap(":/images/retrosharelogo1.png"));
setWindowIcon(QIcon(QString(":/images/rstray3.png")));
ui.textboldButton->setIcon(QIcon(QString(":/images/edit-bold.png")));
@ -124,12 +121,6 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
/*Disabled style Button when will switch chat style RetroShare will crash need to be fix */
//ui.styleButton->setEnabled(false);
/*QMenu * fontmenu = new QMenu();
fontmenu->addAction(ui.actionBold);
fontmenu->addAction(ui.actionUnderline);
fontmenu->addAction(ui.actionItalic);
fontmenu->addAction(ui.actionStrike);
ui.fontButton->setMenu(fontmenu);*/
mCurrentColor = Qt::black;
mCurrentFont = QFont("Comic Sans MS", 10);
@ -317,6 +308,11 @@ std::cout << "PopupChatDialog:addChatMsg message : " << message.toStdString() <<
std::cerr << "received msg saying an avatar for peer " << ci->rsid << " is available." << std::endl ;
updatePeerAvatar(ci->rsid) ;
}
/*else
{
ui.avatarlabel->setPixmap(QPixmap(":/images/user/personal128.png"));
}*/
resetStatusBar() ;
}
@ -688,8 +684,8 @@ void PopupChatDialog::updateAvatar()
// set the image
QPixmap pix ;
pix.loadFromData(data,size,"JPG") ;
ui.myavatarlabel->setPixmap(pix); // writes image into ba in JPG format
pix.loadFromData(data,size,"PNG") ;
ui.myavatarlabel->setPixmap(pix); // writes image into ba in PNGformat
delete[] data ;
}
@ -708,7 +704,7 @@ void PopupChatDialog::getAvatar()
QByteArray ba;
QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly);
picture.save(&buffer, "JPG"); // writes image into ba in JPG format
picture.save(&buffer, "PNG"); // writes image into ba in PNG format
std::cerr << "Image size = " << ba.size() << std::endl ;

View File

@ -342,6 +342,7 @@
<file>images/user/identitygray16.png</file>
<file>images/user/add_user16.png</file>
<file>images/user/personal64.png</file>
<file>images/user/personal128.png</file>
<file>images/user/kuser24.png</file>
<file>images/user/agt_forum128.png</file>
<file>images/up.png</file>