From 758ba49ff1d4230fbc892dde0a21743d470f0ca3 Mon Sep 17 00:00:00 2001 From: defnax Date: Mon, 7 Sep 2009 13:59:38 +0000 Subject: [PATCH] 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 --- retroshare-gui/src/gui/MessengerWindow.cpp | 6 ++--- retroshare-gui/src/gui/PeersDialog.cpp | 6 ++--- .../src/gui/chat/PopupChatDialog.cpp | 24 ++++++++----------- retroshare-gui/src/gui/images.qrc | 1 + 4 files changed, 17 insertions(+), 20 deletions(-) diff --git a/retroshare-gui/src/gui/MessengerWindow.cpp b/retroshare-gui/src/gui/MessengerWindow.cpp index e7b798834..74c8c5735 100644 --- a/retroshare-gui/src/gui/MessengerWindow.cpp +++ b/retroshare-gui/src/gui/MessengerWindow.cpp @@ -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 ; diff --git a/retroshare-gui/src/gui/PeersDialog.cpp b/retroshare-gui/src/gui/PeersDialog.cpp index ed35f4d3d..167f4f7ad 100644 --- a/retroshare-gui/src/gui/PeersDialog.cpp +++ b/retroshare-gui/src/gui/PeersDialog.cpp @@ -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 ; diff --git a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp index 99815c46d..904be3eb5 100644 --- a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp +++ b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp @@ -101,10 +101,7 @@ 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"))); @@ -123,13 +120,7 @@ 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 ; diff --git a/retroshare-gui/src/gui/images.qrc b/retroshare-gui/src/gui/images.qrc index b22990e66..b2fdb2818 100644 --- a/retroshare-gui/src/gui/images.qrc +++ b/retroshare-gui/src/gui/images.qrc @@ -342,6 +342,7 @@ images/user/identitygray16.png images/user/add_user16.png images/user/personal64.png + images/user/personal128.png images/user/kuser24.png images/user/agt_forum128.png images/up.png