mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-26 09:41:29 -05: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.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.addLogoButton->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_ICON));
|
||||||
|
|
||||||
ui.groupDesc->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DESCRIPTION));
|
ui.groupDesc->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DESCRIPTION));
|
||||||
@ -470,7 +470,7 @@ bool GxsGroupDialog::prepareGroupMetaData(RsGroupMetaData &meta)
|
|||||||
return false;
|
return false;
|
||||||
}//switch (ui.idChooser->getChosenId(meta.mAuthorId))
|
}//switch (ui.idChooser->getChosenId(meta.mAuthorId))
|
||||||
|
|
||||||
QString name = misc::removeNewLine(ui.groupName->text());
|
QString name = getName();
|
||||||
uint32_t flags = GXS_SERV::FLAG_PRIVACY_PUBLIC;
|
uint32_t flags = GXS_SERV::FLAG_PRIVACY_PUBLIC;
|
||||||
|
|
||||||
if(name.isEmpty()) {
|
if(name.isEmpty()) {
|
||||||
@ -506,8 +506,8 @@ void GxsGroupDialog::createGroup()
|
|||||||
std::cerr << "GxsGroupDialog::createGroup()";
|
std::cerr << "GxsGroupDialog::createGroup()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
QString name = misc::removeNewLine(ui.groupName->text());
|
/* Check name */
|
||||||
|
QString name = getName();
|
||||||
if(name.isEmpty())
|
if(name.isEmpty())
|
||||||
{
|
{
|
||||||
/* error message */
|
/* error message */
|
||||||
@ -680,15 +680,25 @@ void GxsGroupDialog::addGroupLogo()
|
|||||||
if (img.isNull())
|
if (img.isNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
picture = img;
|
setLogo(img);
|
||||||
|
|
||||||
// to show the selected
|
|
||||||
ui.groupLogo->setPixmap(picture);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap GxsGroupDialog::getLogo()
|
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()
|
QString GxsGroupDialog::getDescription()
|
||||||
@ -707,13 +717,17 @@ void GxsGroupDialog::sendShareList(std::string /*groupId*/)
|
|||||||
|
|
||||||
void GxsGroupDialog::setShareList()
|
void GxsGroupDialog::setShareList()
|
||||||
{
|
{
|
||||||
if (ui.pubKeyShare_cb->isChecked()){
|
if (ui.pubKeyShare_cb->isChecked()) {
|
||||||
this->resize(this->size().width() + ui.contactsdockWidget->size().width(), this->size().height());
|
QMessageBox::warning(this, "", "ToDo");
|
||||||
ui.contactsdockWidget->show();
|
ui.pubKeyShare_cb->setChecked(false);
|
||||||
} else { // hide share widget
|
|
||||||
ui.contactsdockWidget->hide();
|
|
||||||
this->resize(this->size().width() - ui.contactsdockWidget->size().width(), this->size().height());
|
|
||||||
}
|
}
|
||||||
|
// 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();
|
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
|
* This returns a group description string from the ui
|
||||||
* @return group description string
|
* @return group description string
|
||||||
@ -234,7 +247,7 @@ private:
|
|||||||
bool prepareGroupMetaData(RsGroupMetaData &meta);
|
bool prepareGroupMetaData(RsGroupMetaData &meta);
|
||||||
|
|
||||||
std::list<std::string> mShareList;
|
std::list<std::string> mShareList;
|
||||||
QPixmap picture;
|
QPixmap mPicture;
|
||||||
RsTokenService *mTokenService;
|
RsTokenService *mTokenService;
|
||||||
TokenQueue *mExternalTokenQueue;
|
TokenQueue *mExternalTokenQueue;
|
||||||
TokenQueue *mInternalTokenQueue;
|
TokenQueue *mInternalTokenQueue;
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
* Boston, MA 02110-1301, USA.
|
* Boston, MA 02110-1301, USA.
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
|
#include <QBuffer>
|
||||||
|
|
||||||
#include "GxsChannelGroupDialog.h"
|
#include "GxsChannelGroupDialog.h"
|
||||||
|
|
||||||
#include <retroshare/rsgxschannels.h>
|
#include <retroshare/rsgxschannels.h>
|
||||||
@ -94,7 +96,6 @@ QPixmap GxsChannelGroupDialog::serviceImage()
|
|||||||
{
|
{
|
||||||
case MODE_CREATE:
|
case MODE_CREATE:
|
||||||
return QPixmap(":/images/add_channel64.png");
|
return QPixmap(":/images/add_channel64.png");
|
||||||
break;
|
|
||||||
case MODE_SHOW:
|
case MODE_SHOW:
|
||||||
return QPixmap(":/images/channels.png");
|
return QPixmap(":/images/channels.png");
|
||||||
case MODE_EDIT:
|
case MODE_EDIT:
|
||||||
@ -104,12 +105,31 @@ QPixmap GxsChannelGroupDialog::serviceImage()
|
|||||||
return QPixmap();
|
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)
|
bool GxsChannelGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta)
|
||||||
{
|
{
|
||||||
// Specific Function.
|
// Specific Function.
|
||||||
RsGxsChannelGroup grp;
|
RsGxsChannelGroup grp;
|
||||||
grp.mMeta = meta;
|
prepareChannelGroup(grp, meta);
|
||||||
grp.mDescription = getDescription().toUtf8().constData();
|
|
||||||
|
|
||||||
rsGxsChannels->createGroup(token, grp);
|
rsGxsChannels->createGroup(token, grp);
|
||||||
return true;
|
return true;
|
||||||
@ -118,8 +138,7 @@ bool GxsChannelGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMe
|
|||||||
bool GxsChannelGroupDialog::service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta)
|
bool GxsChannelGroupDialog::service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta)
|
||||||
{
|
{
|
||||||
RsGxsChannelGroup grp;
|
RsGxsChannelGroup grp;
|
||||||
grp.mMeta = editedMeta;
|
prepareChannelGroup(grp, editedMeta);
|
||||||
grp.mDescription = getDescription().toUtf8().constData();
|
|
||||||
|
|
||||||
std::cerr << "GxsChannelGroupDialog::service_EditGroup() submitting changes";
|
std::cerr << "GxsChannelGroupDialog::service_EditGroup() submitting changes";
|
||||||
std::cerr << std::endl;
|
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 << "GxsChannelsGroupDialog::service_loadGroup() Unfinished Loading";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
groupMetaData = groups[0].mMeta;
|
const RsGxsChannelGroup &group = groups[0];
|
||||||
description = QString::fromUtf8(groups[0].mDescription.c_str());
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,9 @@ protected:
|
|||||||
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
|
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_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData, QString &description);
|
||||||
virtual bool service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta);
|
virtual bool service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void prepareChannelGroup(RsGxsChannelGroup &group, const RsGroupMetaData &meta);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
const uint32_t ForumCreateEnabledFlags = (
|
const uint32_t ForumCreateEnabledFlags = (
|
||||||
GXS_GROUP_FLAGS_NAME |
|
GXS_GROUP_FLAGS_NAME |
|
||||||
GXS_GROUP_FLAGS_ICON |
|
// GXS_GROUP_FLAGS_ICON |
|
||||||
GXS_GROUP_FLAGS_DESCRIPTION |
|
GXS_GROUP_FLAGS_DESCRIPTION |
|
||||||
GXS_GROUP_FLAGS_DISTRIBUTION |
|
GXS_GROUP_FLAGS_DISTRIBUTION |
|
||||||
// GXS_GROUP_FLAGS_PUBLISHSIGN |
|
// GXS_GROUP_FLAGS_PUBLISHSIGN |
|
||||||
|
Loading…
x
Reference in New Issue
Block a user