mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
- Added picture support to channel gui
- Removed picture support from forum gui - Disabled share key in GxsGroupDialog git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7475 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
eacb69f155
commit
8427c92486
@ -319,7 +319,7 @@ void GxsGroupDialog::setupReadonly()
|
||||
{
|
||||
ui.groupName->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_NAME));
|
||||
|
||||
ui.groupLogo->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_ICON));
|
||||
//ui.groupLogo->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_ICON));
|
||||
ui.addLogoButton->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_ICON));
|
||||
|
||||
ui.groupDesc->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DESCRIPTION));
|
||||
@ -470,7 +470,7 @@ bool GxsGroupDialog::prepareGroupMetaData(RsGroupMetaData &meta)
|
||||
return false;
|
||||
}//switch (ui.idChooser->getChosenId(meta.mAuthorId))
|
||||
|
||||
QString name = misc::removeNewLine(ui.groupName->text());
|
||||
QString name = getName();
|
||||
uint32_t flags = GXS_SERV::FLAG_PRIVACY_PUBLIC;
|
||||
|
||||
if(name.isEmpty()) {
|
||||
@ -506,8 +506,8 @@ void GxsGroupDialog::createGroup()
|
||||
std::cerr << "GxsGroupDialog::createGroup()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
QString name = misc::removeNewLine(ui.groupName->text());
|
||||
|
||||
/* Check name */
|
||||
QString name = getName();
|
||||
if(name.isEmpty())
|
||||
{
|
||||
/* error message */
|
||||
@ -680,20 +680,30 @@ void GxsGroupDialog::addGroupLogo()
|
||||
if (img.isNull())
|
||||
return;
|
||||
|
||||
picture = img;
|
||||
|
||||
// to show the selected
|
||||
ui.groupLogo->setPixmap(picture);
|
||||
setLogo(img);
|
||||
}
|
||||
|
||||
QPixmap GxsGroupDialog::getLogo()
|
||||
{
|
||||
return picture;
|
||||
return mPicture;
|
||||
}
|
||||
|
||||
void GxsGroupDialog::setLogo(const QPixmap &pixmap)
|
||||
{
|
||||
mPicture = pixmap;
|
||||
|
||||
// to show the selected
|
||||
ui.groupLogo->setPixmap(mPicture);
|
||||
}
|
||||
|
||||
QString GxsGroupDialog::getName()
|
||||
{
|
||||
return misc::removeNewLine(ui.groupName->text());
|
||||
}
|
||||
|
||||
QString GxsGroupDialog::getDescription()
|
||||
{
|
||||
return ui.groupDesc->toPlainText();
|
||||
return ui.groupDesc->toPlainText();
|
||||
}
|
||||
|
||||
/***********************************************************************************
|
||||
@ -707,13 +717,17 @@ void GxsGroupDialog::sendShareList(std::string /*groupId*/)
|
||||
|
||||
void GxsGroupDialog::setShareList()
|
||||
{
|
||||
if (ui.pubKeyShare_cb->isChecked()){
|
||||
this->resize(this->size().width() + ui.contactsdockWidget->size().width(), this->size().height());
|
||||
ui.contactsdockWidget->show();
|
||||
} else { // hide share widget
|
||||
ui.contactsdockWidget->hide();
|
||||
this->resize(this->size().width() - ui.contactsdockWidget->size().width(), this->size().height());
|
||||
if (ui.pubKeyShare_cb->isChecked()) {
|
||||
QMessageBox::warning(this, "", "ToDo");
|
||||
ui.pubKeyShare_cb->setChecked(false);
|
||||
}
|
||||
// if (ui.pubKeyShare_cb->isChecked()){
|
||||
// this->resize(this->size().width() + ui.contactsdockWidget->size().width(), this->size().height());
|
||||
// ui.contactsdockWidget->show();
|
||||
// } else { // hide share widget
|
||||
// ui.contactsdockWidget->hide();
|
||||
// this->resize(this->size().width() - ui.contactsdockWidget->size().width(), this->size().height());
|
||||
// }
|
||||
}
|
||||
|
||||
/***********************************************************************************
|
||||
|
@ -195,6 +195,19 @@ protected:
|
||||
*/
|
||||
QPixmap getLogo();
|
||||
|
||||
/*!
|
||||
* This sets a group logo into the ui \n
|
||||
* Should be calleld by deriving service
|
||||
* @param pixmap
|
||||
*/
|
||||
void setLogo(const QPixmap &pixmap);
|
||||
|
||||
/*!
|
||||
* This returns a group name string from the ui
|
||||
* @return group name string
|
||||
*/
|
||||
QString getName();
|
||||
|
||||
/*!
|
||||
* This returns a group description string from the ui
|
||||
* @return group description string
|
||||
@ -234,7 +247,7 @@ private:
|
||||
bool prepareGroupMetaData(RsGroupMetaData &meta);
|
||||
|
||||
std::list<std::string> mShareList;
|
||||
QPixmap picture;
|
||||
QPixmap mPicture;
|
||||
RsTokenService *mTokenService;
|
||||
TokenQueue *mExternalTokenQueue;
|
||||
TokenQueue *mInternalTokenQueue;
|
||||
|
@ -19,6 +19,8 @@
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#include <QBuffer>
|
||||
|
||||
#include "GxsChannelGroupDialog.h"
|
||||
|
||||
#include <retroshare/rsgxschannels.h>
|
||||
@ -94,8 +96,7 @@ QPixmap GxsChannelGroupDialog::serviceImage()
|
||||
{
|
||||
case MODE_CREATE:
|
||||
return QPixmap(":/images/add_channel64.png");
|
||||
break;
|
||||
case MODE_SHOW:
|
||||
case MODE_SHOW:
|
||||
return QPixmap(":/images/channels.png");
|
||||
case MODE_EDIT:
|
||||
return QPixmap(":/images/channels.png");
|
||||
@ -104,12 +105,31 @@ QPixmap GxsChannelGroupDialog::serviceImage()
|
||||
return QPixmap();
|
||||
}
|
||||
|
||||
void GxsChannelGroupDialog::prepareChannelGroup(RsGxsChannelGroup &group, const RsGroupMetaData &meta)
|
||||
{
|
||||
group.mMeta = meta;
|
||||
group.mDescription = getDescription().toUtf8().constData();
|
||||
|
||||
QPixmap pixmap = getLogo();
|
||||
|
||||
if (!pixmap.isNull()) {
|
||||
QByteArray ba;
|
||||
QBuffer buffer(&ba);
|
||||
|
||||
buffer.open(QIODevice::WriteOnly);
|
||||
pixmap.save(&buffer, "PNG"); // writes image into ba in PNG format
|
||||
|
||||
group.mImage.copy((uint8_t *) ba.data(), ba.size());
|
||||
} else {
|
||||
group.mImage.clear();
|
||||
}
|
||||
}
|
||||
|
||||
bool GxsChannelGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta)
|
||||
{
|
||||
// Specific Function.
|
||||
RsGxsChannelGroup grp;
|
||||
grp.mMeta = meta;
|
||||
grp.mDescription = getDescription().toUtf8().constData();
|
||||
prepareChannelGroup(grp, meta);
|
||||
|
||||
rsGxsChannels->createGroup(token, grp);
|
||||
return true;
|
||||
@ -118,8 +138,7 @@ bool GxsChannelGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMe
|
||||
bool GxsChannelGroupDialog::service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta)
|
||||
{
|
||||
RsGxsChannelGroup grp;
|
||||
grp.mMeta = editedMeta;
|
||||
grp.mDescription = getDescription().toUtf8().constData();
|
||||
prepareChannelGroup(grp, editedMeta);
|
||||
|
||||
std::cerr << "GxsChannelGroupDialog::service_EditGroup() submitting changes";
|
||||
std::cerr << std::endl;
|
||||
@ -151,8 +170,16 @@ bool GxsChannelGroupDialog::service_loadGroup(uint32_t token, Mode /*mode*/, RsG
|
||||
std::cerr << "GxsChannelsGroupDialog::service_loadGroup() Unfinished Loading";
|
||||
std::cerr << std::endl;
|
||||
|
||||
groupMetaData = groups[0].mMeta;
|
||||
description = QString::fromUtf8(groups[0].mDescription.c_str());
|
||||
const RsGxsChannelGroup &group = groups[0];
|
||||
groupMetaData = group.mMeta;
|
||||
description = QString::fromUtf8(group.mDescription.c_str());
|
||||
|
||||
if (group.mImage.mData) {
|
||||
QPixmap pixmap;
|
||||
if (pixmap.loadFromData(group.mImage.mData, group.mImage.mSize, "PNG")) {
|
||||
setLogo(pixmap);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -39,6 +39,9 @@ protected:
|
||||
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
|
||||
virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData, QString &description);
|
||||
virtual bool service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta);
|
||||
|
||||
private:
|
||||
void prepareChannelGroup(RsGxsChannelGroup &group, const RsGroupMetaData &meta);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
const uint32_t ForumCreateEnabledFlags = (
|
||||
GXS_GROUP_FLAGS_NAME |
|
||||
GXS_GROUP_FLAGS_ICON |
|
||||
// GXS_GROUP_FLAGS_ICON |
|
||||
GXS_GROUP_FLAGS_DESCRIPTION |
|
||||
GXS_GROUP_FLAGS_DISTRIBUTION |
|
||||
// GXS_GROUP_FLAGS_PUBLISHSIGN |
|
||||
|
Loading…
Reference in New Issue
Block a user