Added connect the Thumbnail Button for select Images/Pictures to use it as Thumbnail for your Channel Item

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2073 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2010-01-18 22:30:21 +00:00
parent eab78c5c03
commit 20646fb349
3 changed files with 34 additions and 5 deletions

View File

@ -44,7 +44,8 @@ CreateChannelMsg::CreateChannelMsg(std::string cId)
connect(buttonBox, SIGNAL(rejected()), this, SLOT(cancelMsg()));
connect(addFileButton, SIGNAL(clicked() ), this , SLOT(addExtraFile()));
connect(addfilepushButton, SIGNAL(clicked() ), this , SLOT(addExtraFile()));
connect(addfilepushButton, SIGNAL(clicked() ), this , SLOT(addExtraFile()));
connect(addThumbnailButton, SIGNAL(clicked() ), this , SLOT(addThumbnail()));
setAcceptDrops(true);
@ -456,8 +457,31 @@ void CreateChannelMsg::sendMessage(std::wstring subject, std::wstring msg, std::
}
void CreateChannelMsg::addThumbnail()
{
QString fileName = QFileDialog::getOpenFileName(this, "Load File", QDir::homePath(), "Pictures (*.png *.xpm *.jpg)");
if(!fileName.isEmpty())
{
picture = QPixmap(fileName).scaled(156,107, Qt::IgnoreAspectRatio);
// to show the selected
thumbnail_label->setPixmap(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 ;
//rsMsgs->setOwnAvatarData((unsigned char *)(ba.data()),ba.size()) ; // last char 0 included.
//updateThumbnail() ;
}
}

View File

@ -42,6 +42,8 @@ public:
bool local, std::string srcId);
void newChannelMsg();
QPixmap picture;
protected:
virtual void dragEnterEvent(QDragEnterEvent *event);
@ -53,6 +55,8 @@ private slots:
void cancelMsg();
void sendMsg();
void addThumbnail();
private:

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>505</width>
<width>509</width>
<height>464</height>
</rect>
</property>
@ -159,7 +159,7 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pushButton">
<widget class="QPushButton" name="addThumbnailButton">
<property name="text">
<string>Add Channel Thumbnail</string>
</property>
@ -172,7 +172,7 @@ p, li { white-space: pre-wrap; }
</layout>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label">
<widget class="QLabel" name="thumbnail_label">
<property name="maximumSize">
<size>
<width>156</width>
@ -352,7 +352,7 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
<width>460</width>
<width>464</width>
<height>282</height>
</rect>
</property>
@ -427,6 +427,7 @@ background: white;}</string>
<resources>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>