mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
added group icon support for blogs and channels
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2905 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
27895d1781
commit
26a808b3e7
@ -43,6 +43,8 @@
|
||||
#include "GeneralMsgDialog.h"
|
||||
|
||||
|
||||
#define CHAN_DEFAULT_IMAGE ":/images/channels.png"
|
||||
|
||||
/****
|
||||
* #define CHAN_DEBUG
|
||||
***/
|
||||
@ -655,6 +657,15 @@ 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 */
|
||||
|
@ -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.
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -49,6 +49,7 @@ private slots:
|
||||
/* actions to take.... */
|
||||
void createBlog();
|
||||
void cancelBlog();
|
||||
void addBlogLogo();
|
||||
|
||||
|
||||
private:
|
||||
|
@ -7,14 +7,14 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>534</width>
|
||||
<height>481</height>
|
||||
<height>545</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Create new Blog</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../images.qrc">
|
||||
<iconset resource="../../images.qrc">
|
||||
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
@ -63,7 +63,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/hi48-app-kblogger.png</pixmap>
|
||||
<pixmap resource="../../images.qrc">:/images/hi48-app-kblogger.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
@ -87,7 +87,7 @@ p, li { white-space: pre-wrap; }
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
@ -95,8 +95,8 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
@ -110,21 +110,17 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Description</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="forumDesc"/>
|
||||
</item>
|
||||
</layout>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Description</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QTextEdit" name="forumDesc"/>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<widget class="QGroupBox" name="tyoeGroupBox">
|
||||
<property name="title">
|
||||
<string>Type:</string>
|
||||
@ -160,7 +156,7 @@ p, li { white-space: pre-wrap; }
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<item row="4" column="0" colspan="3">
|
||||
<widget class="QGroupBox" name="msgGroupBox">
|
||||
<property name="title">
|
||||
<string>Allowed Messages</string>
|
||||
@ -186,15 +182,102 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="3">
|
||||
<widget class="QGroupBox" name="groupBoxLogo">
|
||||
<property name="title">
|
||||
<string>Blog Logo</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QToolButton" name="blogLogoButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">
|
||||
border: 2px solid white;
|
||||
border-radius: 10px;
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../images.qrc">
|
||||
<normaloff>:/images/hi64-app-kblogger.png</normaloff>:/images/hi64-app-kblogger.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="LogoButton">
|
||||
<property name="text">
|
||||
<string>Add Blog Logo</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../images.qrc">
|
||||
<normaloff>:/images/add_image24.png</normaloff>:/images/add_image24.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>118</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
@ -202,7 +285,7 @@ p, li { white-space: pre-wrap; }
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="6" column="0">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -215,14 +298,14 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="6" column="1">
|
||||
<widget class="QPushButton" name="cancelButton">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<item row="6" column="2">
|
||||
<widget class="QPushButton" name="createButton">
|
||||
<property name="text">
|
||||
<string>Create</string>
|
||||
@ -238,7 +321,8 @@ p, li { white-space: pre-wrap; }
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
<include location="../../images.qrc"/>
|
||||
<include location="../../images.qrc"/>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <QMap>
|
||||
#include <QPointer>
|
||||
#include <QObject>
|
||||
#include <qsettings.h>
|
||||
|
||||
#include "ui_CreateBlogMsg.h"
|
||||
#include <stdint.h>
|
||||
|
Loading…
Reference in New Issue
Block a user