diff --git a/retroshare-gui/src/gui/ChannelFeed.cpp b/retroshare-gui/src/gui/ChannelFeed.cpp index dfbaf7b75..b2a4a358a 100644 --- a/retroshare-gui/src/gui/ChannelFeed.cpp +++ b/retroshare-gui/src/gui/ChannelFeed.cpp @@ -43,6 +43,8 @@ #include "GeneralMsgDialog.h" +#define CHAN_DEFAULT_IMAGE ":/images/channels.png" + /**** * #define CHAN_DEBUG ***/ @@ -655,8 +657,17 @@ void ChannelFeed::updateChannelMsgs() return; } + if(ci.pngImageLen != 0){ + + QPixmap chanImage; + chanImage.loadFromData(ci.pngChanImage, ci.pngImageLen, "PNG"); + iconLabel->setPixmap(chanImage); + }else{ + QPixmap defaulImage(CHAN_DEFAULT_IMAGE); + iconLabel->setPixmap(defaulImage); + } iconLabel->setEnabled(true); - + /* set textcolor for Channel name */ QString channelStr("%1"); diff --git a/retroshare-gui/src/gui/channels/CreateChannel.cpp b/retroshare-gui/src/gui/channels/CreateChannel.cpp index 40f00b2e7..4ec38643e 100644 --- a/retroshare-gui/src/gui/channels/CreateChannel.cpp +++ b/retroshare-gui/src/gui/channels/CreateChannel.cpp @@ -33,6 +33,8 @@ CreateChannel::CreateChannel(QWidget *parent) /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); + picture = NULL; + // connect up the buttons. connect( ui.cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancelChannel( ) ) ); connect( ui.createButton, SIGNAL( clicked ( bool ) ), this, SLOT( createChannel( ) ) ); @@ -103,10 +105,19 @@ void CreateChannel::createChannel() { flags |= RS_DISTRIB_AUTHEN_ANON; } + QByteArray ba; + QBuffer buffer(&ba); + + if(!picture.isNull()){ + // send chan image + + buffer.open(QIODevice::WriteOnly); + picture.save(&buffer, "PNG"); // writes image into ba in PNG format + } if (rsChannels) { - rsChannels->createChannel(name.toStdWString(), desc.toStdWString(), flags); + rsChannels->createChannel(name.toStdWString(), desc.toStdWString(), flags, (unsigned char*)ba.data(), ba.size()); } close(); @@ -140,7 +151,5 @@ void CreateChannel::addChannelLogo() std::cerr << "Image size = " << ba.size() << std::endl ; - //rsMsgs->setOwnAvatarData((unsigned char *)(ba.data()),ba.size()) ; // last char 0 included. - } } diff --git a/retroshare-gui/src/gui/unfinished/blogs/CreateBlog.cpp b/retroshare-gui/src/gui/unfinished/blogs/CreateBlog.cpp index 6a72fbbac..83551d3d8 100644 --- a/retroshare-gui/src/gui/unfinished/blogs/CreateBlog.cpp +++ b/retroshare-gui/src/gui/unfinished/blogs/CreateBlog.cpp @@ -36,7 +36,8 @@ CreateBlog::CreateBlog(QWidget *parent, bool isForum) // connect up the buttons. connect( ui.cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancelBlog( ) ) ); connect( ui.createButton, SIGNAL( clicked ( bool ) ), this, SLOT( createBlog( ) ) ); - + connect( ui.LogoButton, SIGNAL(clicked() ), this , SLOT(addBlogLogo())); + connect( ui.blogLogoButton, SIGNAL(clicked() ), this , SLOT(addBlogLogo())); newBlog(); @@ -118,9 +119,20 @@ void CreateBlog::createBlog() flags |= RS_DISTRIB_AUTHEN_ANON; } + QByteArray ba; + QBuffer buffer(&ba); + + if(!picture.isNull()){ + // send chan image + + buffer.open(QIODevice::WriteOnly); + picture.save(&buffer, "PNG"); // writes image into ba in PNG format + } + if (rsBlogs) { - rsBlogs->createBlog(name.toStdWString(), desc.toStdWString(), flags); + rsBlogs->createBlog(name.toStdWString(), desc.toStdWString(), flags, + (unsigned char*) ba.data(), ba.size()); } @@ -128,6 +140,28 @@ void CreateBlog::createBlog() return; } +void CreateBlog::addBlogLogo(){ + + QString fileName = QFileDialog::getOpenFileName(this, "Load File", QDir::homePath(), "Pictures (*.png *.xpm *.jpg)"); + if(!fileName.isEmpty()) + { + picture = QPixmap(fileName).scaled(64,64, Qt::IgnoreAspectRatio); + + // to show the selected + ui.blogLogoButton->setIcon(picture); + + std::cerr << "Sending avatar image down the pipe" << std::endl ; + + // send avatar down the pipe for other peers to get it. + QByteArray ba; + QBuffer buffer(&ba); + buffer.open(QIODevice::WriteOnly); + picture.save(&buffer, "PNG"); // writes image into ba in PNG format + + std::cerr << "Image size = " << ba.size() << std::endl ; + } + +} void CreateBlog::cancelBlog() { diff --git a/retroshare-gui/src/gui/unfinished/blogs/CreateBlog.h b/retroshare-gui/src/gui/unfinished/blogs/CreateBlog.h index 2b9e1578b..8e2779bd2 100644 --- a/retroshare-gui/src/gui/unfinished/blogs/CreateBlog.h +++ b/retroshare-gui/src/gui/unfinished/blogs/CreateBlog.h @@ -49,6 +49,7 @@ private slots: /* actions to take.... */ void createBlog(); void cancelBlog(); +void addBlogLogo(); private: diff --git a/retroshare-gui/src/gui/unfinished/blogs/CreateBlog.ui b/retroshare-gui/src/gui/unfinished/blogs/CreateBlog.ui index 6c789e907..091fa047f 100644 --- a/retroshare-gui/src/gui/unfinished/blogs/CreateBlog.ui +++ b/retroshare-gui/src/gui/unfinished/blogs/CreateBlog.ui @@ -7,14 +7,14 @@ 0 0 534 - 481 + 545 Create new Blog - + :/images/rstray3.png:/images/rstray3.png @@ -63,7 +63,7 @@ - :/images/hi48-app-kblogger.png + :/images/hi48-app-kblogger.png true @@ -87,7 +87,7 @@ p, li { white-space: pre-wrap; } - + QFrame::NoFrame @@ -95,8 +95,8 @@ p, li { white-space: pre-wrap; } QFrame::Raised - - + + @@ -110,21 +110,17 @@ p, li { white-space: pre-wrap; } - - - - - - Description - - - - - - - + + + + Description + + + + + Type: @@ -160,7 +156,7 @@ p, li { white-space: pre-wrap; } - + Allowed Messages @@ -186,15 +182,102 @@ p, li { white-space: pre-wrap; } - - + + + + + + + Blog Logo + + + + 6 + + + 6 + + + 6 + + + 2 + + + 6 + + + + + + + + 64 + 64 + + + + + 64 + 64 + + + + +border: 2px solid white; +border-radius: 10px; + + + + + + + + :/images/hi64-app-kblogger.png:/images/hi64-app-kblogger.png + + + + 64 + 64 + + + + + + + + Add Blog Logo + + + + :/images/add_image24.png:/images/add_image24.png + + + + + + + Qt::Horizontal + + + + 118 + 20 + + + + + + + + - Qt::Vertical + Qt::Horizontal - 20 - 40 + 40 + 20 @@ -202,7 +285,7 @@ p, li { white-space: pre-wrap; } - + Qt::Horizontal @@ -215,14 +298,14 @@ p, li { white-space: pre-wrap; } - + Cancel - + Create @@ -238,7 +321,8 @@ p, li { white-space: pre-wrap; } - + + diff --git a/retroshare-gui/src/gui/unfinished/blogs/CreateBlogMsg.h b/retroshare-gui/src/gui/unfinished/blogs/CreateBlogMsg.h index f253b8e00..3d4109c0a 100644 --- a/retroshare-gui/src/gui/unfinished/blogs/CreateBlogMsg.h +++ b/retroshare-gui/src/gui/unfinished/blogs/CreateBlogMsg.h @@ -26,6 +26,7 @@ #include #include #include +#include #include "ui_CreateBlogMsg.h" #include