mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 00:19:25 -05:00
commit
180cb7aeed
@ -465,14 +465,17 @@ void JsonApiServer::registerHandler(
|
||||
const std::shared_ptr<rb::Session> session,
|
||||
const std::function<void (const std::shared_ptr<rb::Session>)>& callback )
|
||||
{
|
||||
/* Declare outside the lambda to avoid returning a dangling
|
||||
* reference on Android */
|
||||
RsWarn tWarn;
|
||||
const auto authFail =
|
||||
[&path, &session](int status) -> RsWarn::stream_type&
|
||||
[&](int status) -> RsWarn::stream_type&
|
||||
{
|
||||
/* Capture session by reference as it is cheaper then copying
|
||||
* shared_ptr by value which is not needed in this case */
|
||||
|
||||
session->close(status, corsOptionsHeaders);
|
||||
return RsWarn() << "JsonApiServer authentication handler "
|
||||
return tWarn << "JsonApiServer authentication handler "
|
||||
"blocked an attempt to call JSON API "
|
||||
"authenticated method: " << path;
|
||||
};
|
||||
|
@ -404,10 +404,16 @@ int AuthSSLimpl::InitAuth(
|
||||
|
||||
std::cout.flush() ;
|
||||
|
||||
#ifndef RS_DISABLE_DIFFIE_HELLMAN_INIT_CHECK
|
||||
if(DH_check(dh, &codes) && codes == 0)
|
||||
SSL_CTX_set_tmp_dh(sslctx, dh);
|
||||
SSL_CTX_set_tmp_dh(sslctx, dh);
|
||||
else
|
||||
pfs_enabled = false ;
|
||||
pfs_enabled = false;
|
||||
#else // ndef RS_DISABLE_DIFFIE_HELLMAN_INIT_CHECK
|
||||
/* DH_check(...) is not strictly necessary and on Android devices it
|
||||
* takes at least one minute which is untolerable there */
|
||||
SSL_CTX_set_tmp_dh(sslctx, dh);
|
||||
#endif // ndef RS_DISABLE_DIFFIE_HELLMAN_INIT_CHECK
|
||||
}
|
||||
else
|
||||
pfs_enabled = false ;
|
||||
|
@ -43,6 +43,13 @@ struct RsGxsFile : RsSerializable
|
||||
RS_SERIAL_PROCESS(mHash);
|
||||
RS_SERIAL_PROCESS(mSize);
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
mName.clear();
|
||||
mHash.clear();
|
||||
mSize = 0;
|
||||
}
|
||||
};
|
||||
|
||||
struct RsGxsImage : RsSerializable
|
||||
|
@ -34,110 +34,57 @@
|
||||
class RsPhoto;
|
||||
extern RsPhoto *rsPhoto;
|
||||
|
||||
/******************* NEW STUFF FOR NEW CACHE SYSTEM *********/
|
||||
|
||||
#define RSPHOTO_MODE_NEW 1
|
||||
#define RSPHOTO_MODE_OWN 2
|
||||
#define RSPHOTO_MODE_REMOTE 3
|
||||
|
||||
/* If these flags are no set - the Photo inherits values from the Album
|
||||
*/
|
||||
|
||||
#define RSPHOTO_FLAGS_ATTRIB_TITLE 0x0001
|
||||
#define RSPHOTO_FLAGS_ATTRIB_CAPTION 0x0002
|
||||
#define RSPHOTO_FLAGS_ATTRIB_DESC 0x0004
|
||||
#define RSPHOTO_FLAGS_ATTRIB_PHOTOGRAPHER 0x0008
|
||||
#define RSPHOTO_FLAGS_ATTRIB_WHERE 0x0010
|
||||
#define RSPHOTO_FLAGS_ATTRIB_WHEN 0x0020
|
||||
#define RSPHOTO_FLAGS_ATTRIB_OTHER 0x0040
|
||||
#define RSPHOTO_FLAGS_ATTRIB_CATEGORY 0x0080
|
||||
#define RSPHOTO_FLAGS_ATTRIB_HASHTAGS 0x0100
|
||||
#define RSPHOTO_FLAGS_ATTRIB_ORDER 0x0200
|
||||
#define RSPHOTO_FLAGS_ATTRIB_THUMBNAIL 0x0400
|
||||
#define RSPHOTO_FLAGS_ATTRIB_MODE 0x0800
|
||||
#define RSPHOTO_FLAGS_ATTRIB_AUTHOR 0x1000 // PUSH UP ORDER
|
||||
#define RSPHOTO_FLAGS_ATTRIB_PHOTO 0x2000 // PUSH UP ORDER.
|
||||
|
||||
class RsPhotoPhoto
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
RsMsgMetaData mMeta;
|
||||
RsMsgMetaData mMeta;
|
||||
|
||||
RsPhotoPhoto();
|
||||
RsPhotoPhoto();
|
||||
|
||||
// THESE ARE IN THE META DATA.
|
||||
//std::string mAlbumId;
|
||||
//std::string mId;
|
||||
//std::string mTitle; // only used by Album.
|
||||
std::string mCaption;
|
||||
std::string mDescription;
|
||||
std::string mPhotographer;
|
||||
std::string mWhere;
|
||||
std::string mWhen;
|
||||
std::string mOther;
|
||||
std::string mCategory;
|
||||
// V2 PhotoMsg - keep it simple.
|
||||
// mMeta.mTitle used for Photo Caption.
|
||||
// mDescription optional field for addtional notes.
|
||||
// mLowResImage - < 50k jpg of image.
|
||||
// mPhotoFile - transfer details for original photo.
|
||||
std::string mDescription;
|
||||
uint32_t mOrder;
|
||||
RsGxsImage mLowResImage;
|
||||
RsGxsFile mPhotoFile;
|
||||
|
||||
std::string mHashTags;
|
||||
|
||||
uint32_t mSetFlags;
|
||||
|
||||
int mOrder;
|
||||
|
||||
RsGxsImage mThumbnail;
|
||||
|
||||
int mMode;
|
||||
|
||||
// These are not saved.
|
||||
std::string path; // if in Mode NEW.
|
||||
uint32_t mModFlags;
|
||||
// These are not saved.
|
||||
std::string mPath; // if New photo
|
||||
};
|
||||
|
||||
class RsPhotoAlbumShare
|
||||
{
|
||||
public:
|
||||
|
||||
uint32_t mShareType;
|
||||
std::string mShareGroupId;
|
||||
std::string mPublishKey;
|
||||
uint32_t mCommentMode;
|
||||
uint32_t mResizeMode;
|
||||
};
|
||||
#define RSPHOTO_SHAREMODE_LOWRESONLY (1)
|
||||
#define RSPHOTO_SHAREMODE_ORIGINAL (2)
|
||||
#define RSPHOTO_SHAREMODE_DUP_ORIGINAL (3)
|
||||
#define RSPHOTO_SHAREMODE_DUP_200K (4)
|
||||
#define RSPHOTO_SHAREMODE_DUP_1M (5)
|
||||
|
||||
class RsPhotoAlbum
|
||||
{
|
||||
public:
|
||||
RsPhotoAlbum();
|
||||
public:
|
||||
RsPhotoAlbum();
|
||||
|
||||
RsGroupMetaData mMeta;
|
||||
RsGroupMetaData mMeta;
|
||||
|
||||
// THESE ARE IN THE META DATA.
|
||||
//std::string mAlbumId;
|
||||
//std::string mTitle; // only used by Album.
|
||||
// V2 Album - keep it simple.
|
||||
// mMeta.mTitle.
|
||||
uint32_t mShareMode;
|
||||
|
||||
std::string mCaption;
|
||||
std::string mDescription;
|
||||
std::string mPhotographer;
|
||||
std::string mWhere;
|
||||
std::string mWhen;
|
||||
std::string mOther;
|
||||
std::string mCategory;
|
||||
std::string mCaption;
|
||||
std::string mDescription;
|
||||
std::string mPhotographer;
|
||||
std::string mWhere;
|
||||
std::string mWhen;
|
||||
|
||||
std::string mHashTags;
|
||||
RsGxsImage mThumbnail;
|
||||
|
||||
RsGxsImage mThumbnail;
|
||||
|
||||
int mMode;
|
||||
|
||||
std::string mPhotoPath;
|
||||
RsPhotoAlbumShare mShareOptions;
|
||||
|
||||
// These aren't saved.
|
||||
uint32_t mSetFlags;
|
||||
uint32_t mModFlags;
|
||||
// Below is not saved.
|
||||
bool mAutoDownload;
|
||||
};
|
||||
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsPhotoPhoto &photo);
|
||||
std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album);
|
||||
|
||||
@ -145,14 +92,7 @@ typedef std::map<RsGxsGroupId, std::vector<RsPhotoPhoto> > PhotoResult;
|
||||
|
||||
class RsPhoto: public RsGxsIfaceHelper, public RsGxsCommentService
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
static const uint32_t FLAG_MSG_TYPE_PHOTO_POST;
|
||||
static const uint32_t FLAG_MSG_TYPE_PHOTO_COMMENT;
|
||||
static const uint32_t FLAG_MSG_TYPE_MASK;
|
||||
|
||||
|
||||
explicit RsPhoto(RsGxsIface &gxs) : RsGxsIfaceHelper(gxs) { return; }
|
||||
|
||||
virtual ~RsPhoto() { return; }
|
||||
|
@ -642,14 +642,10 @@ void upnphandler::setExternalPort(unsigned short eport_in)
|
||||
dataMtx.unlock(); /*** UNLOCK MUTEX ***/
|
||||
}
|
||||
|
||||
/* as determined by uPnP */
|
||||
bool upnphandler::getInternalAddress(struct sockaddr_storage &addr)
|
||||
/* as determined by uPnP */
|
||||
bool upnphandler::getInternalAddress(struct sockaddr_storage &addr)
|
||||
{
|
||||
// std::cerr << "UPnPHandler::getInternalAddress() pre Lock!" << std::endl;
|
||||
dataMtx.lock(); /*** LOCK MUTEX ***/
|
||||
// std::cerr << "UPnPHandler::getInternalAddress() postLock!" << std::endl;
|
||||
|
||||
std::cerr << "UPnPHandler::getInternalAddress()" << std::endl;
|
||||
RS_STACK_MUTEX(dataMtx);
|
||||
|
||||
// copy to universal addr.
|
||||
sockaddr_storage_clear(addr);
|
||||
@ -657,18 +653,15 @@ bool upnphandler::getInternalAddress(struct sockaddr_storage &addr)
|
||||
|
||||
bool valid = (upnpState >= RS_UPNP_S_ACTIVE);
|
||||
|
||||
dataMtx.unlock(); /*** UNLOCK MUTEX ***/
|
||||
Dbg2() << __PRETTY_FUNCTION__ << " valid: " << valid
|
||||
<< " addr: " << addr << std::endl;
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
bool upnphandler::getExternalAddress(struct sockaddr_storage &addr)
|
||||
bool upnphandler::getExternalAddress(sockaddr_storage &addr)
|
||||
{
|
||||
// std::cerr << "UPnPHandler::getExternalAddress() pre Lock!" << std::endl;
|
||||
dataMtx.lock(); /*** LOCK MUTEX ***/
|
||||
// std::cerr << "UPnPHandler::getExternalAddress() postLock!" << std::endl;
|
||||
|
||||
std::cerr << "UPnPHandler::getExternalAddress()" << std::endl;
|
||||
RS_STACK_MUTEX(dataMtx);
|
||||
|
||||
// copy to universal addr.
|
||||
sockaddr_storage_clear(addr);
|
||||
@ -676,7 +669,8 @@ bool upnphandler::getExternalAddress(struct sockaddr_storage &addr)
|
||||
|
||||
bool valid = (upnpState == RS_UPNP_S_ACTIVE);
|
||||
|
||||
dataMtx.unlock(); /*** UNLOCK MUTEX ***/
|
||||
Dbg2() << __PRETTY_FUNCTION__ << " valid: " << valid
|
||||
<< " addr: " << addr << std::endl;
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
/* platform independent networking... */
|
||||
#include "pqi/pqinetwork.h"
|
||||
#include "pqi/pqiassist.h"
|
||||
|
||||
#include "util/rsdebug.h"
|
||||
#include "util/rsthreads.h"
|
||||
|
||||
class upnpentry
|
||||
@ -97,7 +97,7 @@ bool shutdown_upnp();
|
||||
bool initUPnPState();
|
||||
bool printUPnPState();
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
bool background_setup_upnp(bool, bool);
|
||||
bool checkUPnPActive();
|
||||
@ -123,4 +123,5 @@ bool checkUPnPActive();
|
||||
/* active port forwarding */
|
||||
std::list<upnpforward> activeForwards;
|
||||
|
||||
RS_SET_CONTEXT_DEBUG_LEVEL(1)
|
||||
};
|
||||
|
@ -42,55 +42,44 @@ RsItem *RsGxsPhotoSerialiser::create_item(uint16_t service, uint8_t item_sub_id)
|
||||
|
||||
void RsGxsPhotoAlbumItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
||||
{
|
||||
RsTypeSerializer::serial_process<uint32_t>(j,ctx,TLV_TYPE_UINT32_PARAM,album.mShareMode,"mShareMode");
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_CAPTION, album.mCaption, "mCaption");
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_CATEGORY, album.mCategory, "mCategory");
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_DESCR, album.mDescription, "mDescription");
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_HASH_TAG, album.mHashTags, "mHashTags");
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_MSG, album.mOther, "mOther");
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_PATH, album.mPhotoPath, "mPhotoPath");
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_NAME, album.mPhotographer, "mPhotographer");
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_DATE, album.mWhen, "mWhen");
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_LOCATION, album.mWhere, "mWhere");
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_DATE, album.mWhen, "mWhen");
|
||||
|
||||
album.mThumbnail.serial_process(j, ctx);
|
||||
}
|
||||
void RsGxsPhotoPhotoItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
||||
{
|
||||
RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_CAPTION, photo.mCaption, "mCaption");
|
||||
RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_CATEGORY, photo.mCategory, "mCategory");
|
||||
RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_DESCR, photo.mDescription, "mDescription");
|
||||
RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_HASH_TAG, photo.mHashTags, "mHashTags");
|
||||
RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_MSG, photo.mOther, "mOther");
|
||||
RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_PIC_AUTH, photo.mPhotographer, "mPhotographer");
|
||||
RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_DATE, photo.mWhen, "mWhen");
|
||||
RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_LOCATION, photo.mWhere, "mWhere");
|
||||
|
||||
photo.mThumbnail.serial_process(j, ctx);
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_DESCR, photo.mDescription, "mDescription");
|
||||
RsTypeSerializer::serial_process<uint32_t>(j,ctx,TLV_TYPE_UINT32_PARAM,photo.mOrder,"mOrder");
|
||||
photo.mLowResImage.serial_process(j, ctx);
|
||||
photo.mPhotoFile.serial_process(j, ctx);
|
||||
}
|
||||
|
||||
void RsGxsPhotoAlbumItem::clear()
|
||||
{
|
||||
album.mShareMode = RSPHOTO_SHAREMODE_LOWRESONLY;
|
||||
album.mCaption.clear();
|
||||
album.mCategory.clear();
|
||||
album.mDescription.clear();
|
||||
album.mHashTags.clear();
|
||||
album.mOther.clear();
|
||||
album.mPhotoPath.clear();
|
||||
album.mPhotographer.clear();
|
||||
album.mWhen.clear();
|
||||
album.mWhere.clear();
|
||||
album.mWhen.clear();
|
||||
album.mThumbnail.clear();
|
||||
|
||||
// not saved
|
||||
album.mAutoDownload = false;
|
||||
}
|
||||
|
||||
void RsGxsPhotoPhotoItem::clear()
|
||||
{
|
||||
photo.mCaption.clear();
|
||||
photo.mCategory.clear();
|
||||
photo.mDescription.clear();
|
||||
photo.mHashTags.clear();
|
||||
photo.mOther.clear();
|
||||
photo.mPhotographer.clear();
|
||||
photo.mWhen.clear();
|
||||
photo.mWhere.clear();
|
||||
photo.mThumbnail.clear();
|
||||
photo.mOrder = 0;
|
||||
photo.mLowResImage.clear();
|
||||
photo.mPhotoFile.clear();
|
||||
|
||||
// not saved
|
||||
photo.mPath.clear();
|
||||
}
|
||||
|
@ -3002,9 +3002,11 @@ void p3IdService::requestIdsFromNet()
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG_IDS
|
||||
RsInfo() << __PRETTY_FUNCTION__ << " no online peers among supplied"
|
||||
<< " list in request for RsGxsId: " << gxsId
|
||||
<< ". Keeping it until peers show up."<< std::endl;
|
||||
#endif
|
||||
++cit;
|
||||
}
|
||||
}
|
||||
|
@ -25,19 +25,14 @@
|
||||
|
||||
RsPhoto *rsPhoto = NULL;
|
||||
|
||||
|
||||
const uint32_t RsPhoto::FLAG_MSG_TYPE_MASK = 0x000f;
|
||||
const uint32_t RsPhoto::FLAG_MSG_TYPE_PHOTO_POST = 0x0001;
|
||||
const uint32_t RsPhoto::FLAG_MSG_TYPE_PHOTO_COMMENT = 0x0002;
|
||||
|
||||
RsPhotoPhoto::RsPhotoPhoto()
|
||||
:mSetFlags(0), mOrder(0), mMode(0), mModFlags(0)
|
||||
:mOrder(0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RsPhotoAlbum::RsPhotoAlbum()
|
||||
:mMode(0), mSetFlags(0), mModFlags(0)
|
||||
:mShareMode(RSPHOTO_SHAREMODE_LOWRESONLY), mAutoDownload(false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ bool RetroDb::execSQL(const std::string &query){
|
||||
|
||||
|
||||
uint32_t delta = 3;
|
||||
rstime_t stamp = time(NULL), now = 0;
|
||||
rstime_t stamp = time(NULL);
|
||||
bool timeOut = false, ok = false;
|
||||
|
||||
while(!timeOut){
|
||||
@ -202,10 +202,8 @@ bool RetroDb::execSQL(const std::string &query){
|
||||
break;
|
||||
}
|
||||
|
||||
now = time(NULL);
|
||||
delta = stamp - now;
|
||||
|
||||
if(delta > TIME_LIMIT){
|
||||
if(time(NULL) > stamp + TIME_LIMIT)
|
||||
{
|
||||
ok = false;
|
||||
timeOut = true;
|
||||
}
|
||||
|
@ -515,6 +515,68 @@ void IdDialog::updateCircles()
|
||||
});
|
||||
}
|
||||
|
||||
static QTreeWidgetItem *setChildItem(QTreeWidgetItem *item, const RsGroupMetaData& circle_group)
|
||||
{
|
||||
QString test_str = QString::fromStdString(circle_group.mGroupId.toStdString());
|
||||
|
||||
// 1 - check if the item already exists and remove possible duplicates
|
||||
|
||||
std::vector<uint32_t> found_indices;
|
||||
|
||||
for(uint32_t k=0; k < (uint32_t)item->childCount(); ++k)
|
||||
if( item->child(k)->data(CIRCLEGROUP_CIRCLE_COL_GROUPID,Qt::UserRole).toString() == test_str)
|
||||
found_indices.push_back(k);
|
||||
|
||||
while(found_indices.size() > 1) // delete duplicates, starting from the end in order that deletion preserves indices
|
||||
{
|
||||
delete item->takeChild(found_indices.back());
|
||||
found_indices.pop_back();
|
||||
}
|
||||
|
||||
if(!found_indices.empty())
|
||||
{
|
||||
QTreeWidgetItem *subitem = item->child(found_indices[0]);
|
||||
|
||||
if(subitem->text(CIRCLEGROUP_CIRCLE_COL_GROUPNAME) != QString::fromUtf8(circle_group.mGroupName.c_str()))
|
||||
{
|
||||
#ifdef ID_DEBUG
|
||||
std::cerr << " Existing circle has a new name. Updating it in the tree." << std::endl;
|
||||
#endif
|
||||
subitem->setText(CIRCLEGROUP_CIRCLE_COL_GROUPNAME, QString::fromUtf8(circle_group.mGroupName.c_str()));
|
||||
}
|
||||
|
||||
return subitem;
|
||||
}
|
||||
|
||||
// 2 - if not, create
|
||||
|
||||
QTreeWidgetItem *subitem = new QTreeWidgetItem();
|
||||
|
||||
subitem->setText(CIRCLEGROUP_CIRCLE_COL_GROUPNAME, QString::fromUtf8(circle_group.mGroupName.c_str()));
|
||||
subitem->setData(CIRCLEGROUP_CIRCLE_COL_GROUPID,Qt::UserRole, QString::fromStdString(circle_group.mGroupId.toStdString()));
|
||||
subitem->setData(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS, Qt::UserRole, QVariant(circle_group.mSubscribeFlags));
|
||||
|
||||
item->addChild(subitem);
|
||||
|
||||
return subitem;
|
||||
}
|
||||
|
||||
static void removeChildItem(QTreeWidgetItem *item, const RsGroupMetaData& circle_group)
|
||||
{
|
||||
QString test_str = QString::fromStdString(circle_group.mGroupId.toStdString());
|
||||
|
||||
// 1 - check if the item already exists and remove possible duplicates
|
||||
|
||||
std::list<uint32_t> found_indices;
|
||||
|
||||
for(uint32_t k=0; k < (uint32_t)item->childCount(); ++k)
|
||||
if( item->child(k)->data(CIRCLEGROUP_CIRCLE_COL_GROUPID,Qt::UserRole).toString() == test_str)
|
||||
found_indices.push_front(k);
|
||||
|
||||
for(auto k:found_indices)
|
||||
delete item->takeChild(k); // delete items in the reverse order (because of the push_front()), so that indices are preserved
|
||||
}
|
||||
|
||||
void IdDialog::loadCircles(const std::list<RsGroupMetaData>& groupInfo)
|
||||
{
|
||||
#ifdef ID_DEBUG
|
||||
@ -561,102 +623,27 @@ void IdDialog::loadCircles(const std::list<RsGroupMetaData>& groupInfo)
|
||||
bool am_I_in_circle = details.mAmIAllowed ;
|
||||
bool am_I_admin (vit->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN) ;
|
||||
bool am_I_subscribed (vit->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED) ;
|
||||
QTreeWidgetItem *item = NULL ;
|
||||
|
||||
#ifdef ID_DEBUG
|
||||
std::cerr << "Loaded info for circle " << vit->mGroupId << ". am_I_in_circle=" << am_I_in_circle << std::endl;
|
||||
#endif
|
||||
|
||||
// find already existing items for this circle
|
||||
|
||||
// implement the search manually, because there's no find based on user role.
|
||||
//QList<QTreeWidgetItem*> clist = ui->treeWidget_membership->findItems( QString::fromStdString(vit->mGroupId.toStdString()), Qt::MatchExactly|Qt::MatchRecursive, CIRCLEGROUP_CIRCLE_COL_GROUPID);
|
||||
QList<QTreeWidgetItem*> clist ;
|
||||
QString test_str = QString::fromStdString(vit->mGroupId.toStdString()) ;
|
||||
for(QTreeWidgetItemIterator itt(ui->treeWidget_membership);*itt;++itt)
|
||||
if( (*itt)->data(CIRCLEGROUP_CIRCLE_COL_GROUPID,Qt::UserRole).toString() == test_str)
|
||||
clist.push_back(*itt) ;
|
||||
|
||||
if(!clist.empty())
|
||||
{
|
||||
// delete all duplicate items. This should not happen, but just in case it does.
|
||||
|
||||
while(clist.size() > 1)
|
||||
{
|
||||
#ifdef ID_DEBUG
|
||||
std::cerr << " more than 1 item correspond to this ID. Removing!" << std::endl;
|
||||
#endif
|
||||
delete clist.front() ;
|
||||
clist.pop_front();
|
||||
}
|
||||
|
||||
item = clist.front() ;
|
||||
|
||||
#ifdef CIRCLE_MEMBERSHIP_CATEGORIES
|
||||
if(am_I_in_circle && item->parent() != mExternalBelongingCircleItem)
|
||||
{
|
||||
#ifdef ID_DEBUG
|
||||
std::cerr << " Existing circle is not in subscribed items although it is subscribed. Removing." << std::endl;
|
||||
#endif
|
||||
delete item ;
|
||||
item = NULL ;
|
||||
}
|
||||
else if(!am_I_in_circle && item->parent() != mExternalOtherCircleItem)
|
||||
{
|
||||
#ifdef ID_DEBUG
|
||||
std::cerr << " Existing circle is not in subscribed items although it is subscribed. Removing." << std::endl;
|
||||
#endif
|
||||
delete item ;
|
||||
item = NULL ;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
should_re_add = false ; // item already exists
|
||||
}
|
||||
|
||||
/* Add Widget, and request Pages */
|
||||
|
||||
if(should_re_add)
|
||||
{
|
||||
item = new QTreeWidgetItem();
|
||||
|
||||
item->setText(CIRCLEGROUP_CIRCLE_COL_GROUPNAME, QString::fromUtf8(vit->mGroupName.c_str()));
|
||||
item->setData(CIRCLEGROUP_CIRCLE_COL_GROUPID,Qt::UserRole, QString::fromStdString(vit->mGroupId.toStdString()));
|
||||
item->setData(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS, Qt::UserRole, QVariant(vit->mSubscribeFlags));
|
||||
|
||||
#ifdef CIRCLE_MEMBERSHIP_CATEGORIES
|
||||
if(am_I_in_circle)
|
||||
{
|
||||
#ifdef ID_DEBUG
|
||||
std::cerr << " adding item for circle " << vit->mGroupId << " to own circles"<< std::endl;
|
||||
#endif
|
||||
mExternalBelongingCircleItem->addChild(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef ID_DEBUG
|
||||
std::cerr << " adding item for circle " << vit->mGroupId << " to others"<< std::endl;
|
||||
#endif
|
||||
mExternalOtherCircleItem->addChild(item);
|
||||
}
|
||||
#else
|
||||
ui->treeWidget_membership->addTopLevelItem(item) ;
|
||||
#endif
|
||||
}
|
||||
else if(item->text(CIRCLEGROUP_CIRCLE_COL_GROUPNAME) != QString::fromUtf8(vit->mGroupName.c_str()))
|
||||
{
|
||||
#ifdef ID_DEBUG
|
||||
std::cerr << " Existing circle has a new name. Updating it in the tree." << std::endl;
|
||||
#endif
|
||||
item->setText(CIRCLEGROUP_CIRCLE_COL_GROUPNAME, QString::fromUtf8(vit->mGroupName.c_str()));
|
||||
}
|
||||
// just in case.
|
||||
// Find already existing items for this circle, or create one.
|
||||
QTreeWidgetItem *item = NULL ;
|
||||
|
||||
if(am_I_in_circle)
|
||||
{
|
||||
item = setChildItem(mExternalBelongingCircleItem,*vit);
|
||||
removeChildItem(mExternalOtherCircleItem,*vit);
|
||||
}
|
||||
else
|
||||
{
|
||||
item = setChildItem(mExternalOtherCircleItem,*vit);
|
||||
removeChildItem(mExternalBelongingCircleItem,*vit);
|
||||
}
|
||||
item->setData(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS, Qt::UserRole, QVariant(vit->mSubscribeFlags));
|
||||
|
||||
QString tooltip ;
|
||||
tooltip += tr("Circle ID: ")+QString::fromStdString(vit->mGroupId.toStdString()) ;
|
||||
|
||||
tooltip += "\n"+tr("Visibility: ");
|
||||
|
||||
if(details.mRestrictedCircleId == details.mCircleId)
|
||||
@ -1532,11 +1519,12 @@ void IdDialog::loadIdentities(const std::map<RsGxsGroupId,RsGxsIdGroup>& ids_set
|
||||
contactsItem->addChild(item);
|
||||
else
|
||||
allItem->addChild(item);
|
||||
}
|
||||
GxsIdLabel *label = new GxsIdLabel();
|
||||
label->setId(RsGxsId(data.mMeta.mGroupId)) ;
|
||||
|
||||
ui->treeWidget_membership->setItemWidget(item,0,label) ;
|
||||
GxsIdLabel *label = new GxsIdLabel();
|
||||
label->setId(RsGxsId(data.mMeta.mGroupId)) ;
|
||||
|
||||
ui->treeWidget_membership->setItemWidget(item,0,label) ;
|
||||
}
|
||||
}
|
||||
|
||||
/* count items */
|
||||
|
@ -1,204 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.cpp *
|
||||
* *
|
||||
* Copyright (C) 2018 by Retroshare Team <retroshare.project@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include <QBuffer>
|
||||
|
||||
#include "AlbumCreateDialog.h"
|
||||
#include "ui_AlbumCreateDialog.h"
|
||||
|
||||
#include "util/misc.h"
|
||||
#include "retroshare/rsgxsflags.h"
|
||||
|
||||
AlbumCreateDialog::AlbumCreateDialog(TokenQueue *photoQueue, RsPhoto *rs_photo, QWidget *parent):
|
||||
QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
|
||||
ui(new Ui::AlbumCreateDialog), mPhotoQueue(photoQueue), mRsPhoto(rs_photo), mPhotoSelected(NULL)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->headerFrame->setHeaderImage(QPixmap(":/images/album_create_64.png"));
|
||||
ui->headerFrame->setHeaderText(tr("Create Album"));
|
||||
|
||||
|
||||
#if QT_VERSION >= 0x040700
|
||||
ui->lineEdit_Title_2->setPlaceholderText(tr("Untitle Album"));
|
||||
ui->lineEdit_Caption_2->setPlaceholderText(tr("Say something about this album..."));
|
||||
//ui->textEdit_Description->setPlaceholderText(tr("Say something about this album...")) ;
|
||||
ui->lineEdit_Where->setPlaceholderText(tr("Where were these taken?"));
|
||||
#endif
|
||||
|
||||
ui->backButton->hide();
|
||||
|
||||
connect(ui->publishButton, SIGNAL(clicked()), this, SLOT(publishAlbum()));
|
||||
connect(ui->AlbumThumbNail, SIGNAL(clicked()), this, SLOT(addAlbumThumbnail()));
|
||||
|
||||
connect(ui->addphotosButton, SIGNAL(clicked()),this, SLOT(changePage()));
|
||||
connect(ui->backButton, SIGNAL(clicked()),this, SLOT(backPage()));
|
||||
|
||||
|
||||
mPhotoDrop = ui->scrollAreaWidgetContents;
|
||||
mPhotoDrop->setPhotoItemHolder(this);
|
||||
|
||||
|
||||
}
|
||||
|
||||
AlbumCreateDialog::~AlbumCreateDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
#define PUBLIC_INDEX 0
|
||||
#define RESTRICTED_INDEX 1
|
||||
#define PRIVATE_INDEX 2
|
||||
|
||||
void AlbumCreateDialog::publishAlbum()
|
||||
{
|
||||
// get fields for album to publish, publish and then exit dialog
|
||||
RsPhotoAlbum album;
|
||||
|
||||
album.mCaption = ui->lineEdit_Caption_2->text().toStdString();
|
||||
album.mPhotographer = ui->lineEdit_Photographer->text().toStdString();
|
||||
album.mMeta.mGroupName = ui->lineEdit_Title_2->text().toStdString();
|
||||
album.mDescription = ui->textEdit_Description->toPlainText().toStdString();
|
||||
album.mWhere = ui->lineEdit_Where->text().toStdString();
|
||||
album.mPhotographer = ui->lineEdit_Photographer->text().toStdString();
|
||||
getAlbumThumbnail(album.mThumbnail);
|
||||
|
||||
|
||||
int currIndex = ui->privacyComboBox->currentIndex();
|
||||
|
||||
switch(currIndex)
|
||||
{
|
||||
case PUBLIC_INDEX:
|
||||
album.mMeta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_PUBLIC;
|
||||
break;
|
||||
case RESTRICTED_INDEX:
|
||||
album.mMeta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_RESTRICTED;
|
||||
break;
|
||||
case PRIVATE_INDEX:
|
||||
album.mMeta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_PRIVATE;
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t token;
|
||||
mRsPhoto->submitAlbumDetails(token, album);
|
||||
mPhotoQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
|
||||
|
||||
publishPhotos();
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
void AlbumCreateDialog::publishPhotos()
|
||||
{
|
||||
// get fields for album to publish, publish and then exit dialog
|
||||
RsPhotoAlbum album;
|
||||
|
||||
QSet<PhotoItem*> photos;
|
||||
|
||||
mPhotoDrop->getPhotos(photos);
|
||||
|
||||
QSetIterator<PhotoItem*> sit(photos);
|
||||
|
||||
while(sit.hasNext())
|
||||
{
|
||||
PhotoItem* item = sit.next();
|
||||
uint32_t token;
|
||||
RsPhotoPhoto photo = item->getPhotoDetails();
|
||||
photo.mMeta.mGroupId = album.mMeta.mGroupId;
|
||||
mRsPhoto->submitPhoto(token, photo);
|
||||
mPhotoQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool AlbumCreateDialog::getAlbumThumbnail(RsGxsImage &image)
|
||||
{
|
||||
const QPixmap *tmppix = &mThumbNail;
|
||||
|
||||
QByteArray ba;
|
||||
QBuffer buffer(&ba);
|
||||
|
||||
if(!tmppix->isNull())
|
||||
{
|
||||
// send chan image
|
||||
|
||||
buffer.open(QIODevice::WriteOnly);
|
||||
tmppix->save(&buffer, "PNG"); // writes image into ba in PNG format
|
||||
|
||||
image.copy((uint8_t *) ba.data(), ba.size());
|
||||
return true;
|
||||
}
|
||||
|
||||
image.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
void AlbumCreateDialog::addAlbumThumbnail()
|
||||
{
|
||||
QPixmap img = misc::getOpenThumbnailedPicture(this, tr("Load Album Thumbnail"), 128, 128);
|
||||
|
||||
if (img.isNull())
|
||||
return;
|
||||
|
||||
mThumbNail = img;
|
||||
|
||||
// to show the selected
|
||||
ui->AlbumThumbNail->setIcon(mThumbNail);
|
||||
}
|
||||
|
||||
void AlbumCreateDialog::changePage()
|
||||
{
|
||||
int nextPage = ui->stackedWidget->currentIndex() + 1;
|
||||
if (nextPage >= ui->stackedWidget->count())
|
||||
nextPage = 0;
|
||||
ui->stackedWidget->setCurrentIndex(nextPage);
|
||||
|
||||
ui->backButton->show();
|
||||
ui->addphotosButton->hide();
|
||||
}
|
||||
|
||||
void AlbumCreateDialog::backPage()
|
||||
{
|
||||
int nextPage = ui->stackedWidget->currentIndex() - 1;
|
||||
if (nextPage >= ui->stackedWidget->count())
|
||||
nextPage = 0;
|
||||
ui->stackedWidget->setCurrentIndex(nextPage);
|
||||
|
||||
ui->backButton->hide();
|
||||
ui->addphotosButton->show();
|
||||
}
|
||||
|
||||
void AlbumCreateDialog::notifySelection(PhotoShareItem *selection)
|
||||
{
|
||||
|
||||
PhotoItem* pItem = dynamic_cast<PhotoItem*>(selection);
|
||||
|
||||
if(mPhotoSelected == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
mPhotoSelected->setSelected(false);
|
||||
mPhotoSelected = pItem;
|
||||
}
|
||||
|
||||
mPhotoSelected->setSelected(true);
|
||||
}
|
@ -1,71 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.h *
|
||||
* *
|
||||
* Copyright (C) 2018 by Retroshare Team <retroshare.project@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef ALBUMCREATEDIALOG_H
|
||||
#define ALBUMCREATEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "util/TokenQueue.h"
|
||||
#include "retroshare/rsphoto.h"
|
||||
#include "retroshare/rsphoto.h"
|
||||
#include "PhotoShareItemHolder.h"
|
||||
#include "PhotoItem.h"
|
||||
#include "PhotoDrop.h"
|
||||
|
||||
namespace Ui {
|
||||
class AlbumCreateDialog;
|
||||
}
|
||||
|
||||
|
||||
class AlbumCreateDialog : public QDialog, public PhotoShareItemHolder
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AlbumCreateDialog(TokenQueue* photoQueue, RsPhoto* rs_photo, QWidget *parent = 0);
|
||||
~AlbumCreateDialog();
|
||||
|
||||
void notifySelection(PhotoShareItem* selection);
|
||||
|
||||
|
||||
private slots:
|
||||
void publishAlbum();
|
||||
void publishPhotos();
|
||||
void addAlbumThumbnail();
|
||||
void changePage();
|
||||
void backPage();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
bool getAlbumThumbnail(RsGxsImage &image);
|
||||
private:
|
||||
Ui::AlbumCreateDialog *ui;
|
||||
|
||||
TokenQueue* mPhotoQueue;
|
||||
RsPhoto* mRsPhoto;
|
||||
QPixmap mThumbNail;
|
||||
PhotoDrop* mPhotoDrop;
|
||||
PhotoItem* mPhotoSelected;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // ALBUMCREATEDIALOG_H
|
@ -1,539 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AlbumCreateDialog</class>
|
||||
<widget class="QDialog" name="AlbumCreateDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>643</width>
|
||||
<height>550</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Create Album</string>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="HeaderFrame" name="headerFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="margin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string>Album Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Title_2"/>
|
||||
</item>
|
||||
<item row="0" column="2" rowspan="2">
|
||||
<widget class="QToolButton" name="AlbumThumbNail">
|
||||
<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="Photo_images.qrc">
|
||||
<normaloff>:/images/album_64.png</normaloff>:/images/album_64.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
<string>Category:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBox_Category_2">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Animals</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Family</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Friends</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Flowers</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Holiday</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Landscapes</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pets</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Portraits</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Travel</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Work</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Random</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="captionLabel">
|
||||
<property name="text">
|
||||
<string>Caption:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="lineEdit_Caption_2"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Where:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="lineEdit_Where"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Photographer:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="lineEdit_Photographer"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Description:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1" rowspan="2" colspan="2">
|
||||
<widget class="QTextEdit" name="textEdit_Description"/>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Share Options</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Policy:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Quality:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Comments:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Identity:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="privacyComboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Public</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Restricted</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_5">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Resize Images (< 1Mb)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Resize Images (< 10Mb)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Send Original Images</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>No Comments Allowed</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Authenticated Comments</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Any Comments Allowed</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Publish with Identity</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>168</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_2">
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5" stretch="0,10">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; font-weight:600;"> Drag &amp; Drop to insert pictures. Click on a picture to edit details below.</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollAreaPhotos">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>10</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="acceptDrops">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
|
||||
</property>
|
||||
<widget class="PhotoDrop" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>621</width>
|
||||
<height>458</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QWidget#scrollAreaWidgetContents{border: none;}</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_10"/>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>419</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="backButton">
|
||||
<property name="text">
|
||||
<string>Back</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addphotosButton">
|
||||
<property name="text">
|
||||
<string>Add Photos</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="publishButton">
|
||||
<property name="text">
|
||||
<string>Publish Album</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>HeaderFrame</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>gui/common/HeaderFrame.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>PhotoDrop</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/PhotoShare/PhotoDrop.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
<include location="Photo_images.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>AlbumCreateDialog</receiver>
|
||||
<slot>close()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>353</x>
|
||||
<y>529</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>321</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -59,7 +59,6 @@ void AlbumDialog::setUp()
|
||||
{
|
||||
ui->lineEdit_Title->setText(QString::fromStdString(mAlbum.mMeta.mGroupName));
|
||||
ui->lineEdit_Caption->setText(QString::fromStdString(mAlbum.mCaption));
|
||||
ui->lineEdit_Category->setText(QString::fromStdString(mAlbum.mCategory));
|
||||
|
||||
if (mAlbum.mThumbnail.mSize != 0)
|
||||
{
|
||||
@ -121,7 +120,7 @@ void AlbumDialog::updateAlbumPhotos()
|
||||
// flag image as Deleted.
|
||||
// clear image.
|
||||
// clear file URL (todo)
|
||||
photo.mThumbnail.clear();
|
||||
photo.mLowResImage.clear();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -221,7 +220,6 @@ void AlbumDialog::loadPhotoData(const uint32_t &token)
|
||||
rsPhoto->getPhoto(token, res);
|
||||
PhotoResult::iterator mit = res.begin();
|
||||
|
||||
|
||||
for (; mit != res.end(); ++mit)
|
||||
{
|
||||
std::vector<RsPhotoPhoto>& photoV = mit->second;
|
||||
@ -230,8 +228,7 @@ void AlbumDialog::loadPhotoData(const uint32_t &token)
|
||||
for (; vit != photoV.end(); ++vit)
|
||||
{
|
||||
RsPhotoPhoto& photo = *vit;
|
||||
|
||||
if (!photo.mThumbnail.empty()) {
|
||||
if (!photo.mLowResImage.empty()) {
|
||||
addPhoto(photo);
|
||||
}
|
||||
}
|
||||
@ -287,5 +284,3 @@ void AlbumDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
}
|
||||
|
||||
/**************************** Request / Response Filling of Data ************************/
|
||||
|
||||
|
||||
|
@ -22,16 +22,16 @@
|
||||
#include "ui_AlbumExtra.h"
|
||||
|
||||
AlbumExtra::AlbumExtra(QWidget *parent) :
|
||||
QWidget(NULL),
|
||||
ui(new Ui::AlbumExtra)
|
||||
QWidget(NULL),
|
||||
ui(new Ui::AlbumExtra)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setUp();
|
||||
ui->setupUi(this);
|
||||
setUp();
|
||||
}
|
||||
|
||||
AlbumExtra::~AlbumExtra()
|
||||
{
|
||||
delete ui;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void AlbumExtra::setUp()
|
||||
@ -39,3 +39,53 @@ void AlbumExtra::setUp()
|
||||
|
||||
}
|
||||
|
||||
void AlbumExtra::setShareMode(uint32_t mode)
|
||||
{
|
||||
ui->comboBox_shareMode->setCurrentIndex(mode);
|
||||
}
|
||||
|
||||
void AlbumExtra::setCaption(const std::string &str)
|
||||
{
|
||||
ui->lineEdit_Caption->setText(QString::fromStdString(str));
|
||||
}
|
||||
|
||||
void AlbumExtra::setPhotographer(const std::string &str)
|
||||
{
|
||||
ui->lineEdit_Photographer->setText(QString::fromStdString(str));
|
||||
}
|
||||
|
||||
void AlbumExtra::setWhere(const std::string &str)
|
||||
{
|
||||
ui->lineEdit_Where->setText(QString::fromStdString(str));
|
||||
}
|
||||
|
||||
void AlbumExtra::setWhen(const std::string &str)
|
||||
{
|
||||
ui->lineEdit_When->setText(QString::fromStdString(str));
|
||||
}
|
||||
|
||||
uint32_t AlbumExtra::getShareMode()
|
||||
{
|
||||
return ui->comboBox_shareMode->currentIndex();
|
||||
}
|
||||
|
||||
std::string AlbumExtra::getCaption()
|
||||
{
|
||||
return ui->lineEdit_Caption->text().toStdString();
|
||||
}
|
||||
|
||||
std::string AlbumExtra::getPhotographer()
|
||||
{
|
||||
return ui->lineEdit_Photographer->text().toStdString();
|
||||
}
|
||||
|
||||
std::string AlbumExtra::getWhere()
|
||||
{
|
||||
return ui->lineEdit_Where->text().toStdString();
|
||||
}
|
||||
|
||||
std::string AlbumExtra::getWhen()
|
||||
{
|
||||
return ui->lineEdit_When->text().toStdString();
|
||||
}
|
||||
|
||||
|
@ -24,21 +24,33 @@
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class AlbumExtra;
|
||||
class AlbumExtra;
|
||||
}
|
||||
|
||||
class AlbumExtra : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AlbumExtra(QWidget *parent = 0);
|
||||
virtual ~AlbumExtra();
|
||||
explicit AlbumExtra(QWidget *parent = 0);
|
||||
virtual ~AlbumExtra();
|
||||
|
||||
void setShareMode(uint32_t mode);
|
||||
void setCaption(const std::string &str);
|
||||
void setPhotographer(const std::string &str);
|
||||
void setWhere(const std::string &str);
|
||||
void setWhen(const std::string &str);
|
||||
|
||||
uint32_t getShareMode();
|
||||
std::string getCaption();
|
||||
std::string getPhotographer();
|
||||
std::string getWhere();
|
||||
std::string getWhen();
|
||||
|
||||
private:
|
||||
void setUp();
|
||||
void setUp();
|
||||
private:
|
||||
Ui::AlbumExtra *ui;
|
||||
Ui::AlbumExtra *ui;
|
||||
};
|
||||
|
||||
#endif // ALBUMEXTRA_H
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>513</width>
|
||||
<height>198</height>
|
||||
<width>516</width>
|
||||
<height>199</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -21,119 +21,73 @@
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
<string>Category:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBox_Category_2">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Animals</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Family</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Friends</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Flowers</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Holiday</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Landscapes</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pets</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Portraits</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Travel</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Work</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Random</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Quality:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBox_5">
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBox_shareMode">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Embedded Only (<50Kb)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Share Original Images</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Copy Original Images (extra disk space)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Resize Images (< 200Kb)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Resize Images (< 1Mb)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Resize Images (< 10Mb)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Send Original Images</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="captionLabel">
|
||||
<property name="text">
|
||||
<string>Caption:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Caption"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Photographer:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Caption_2"/>
|
||||
<widget class="QLineEdit" name="lineEdit_Photographer"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
@ -146,14 +100,14 @@
|
||||
<widget class="QLineEdit" name="lineEdit_Where"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Photographer:</string>
|
||||
<string>When:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Photographer"/>
|
||||
<widget class="QLineEdit" name="lineEdit_When"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -26,8 +26,8 @@
|
||||
#include <iostream>
|
||||
|
||||
const uint32_t AlbumCreateEnabledFlags = (
|
||||
GXS_GROUP_FLAGS_NAME |
|
||||
GXS_GROUP_FLAGS_ICON |
|
||||
GXS_GROUP_FLAGS_NAME |
|
||||
GXS_GROUP_FLAGS_ICON |
|
||||
GXS_GROUP_FLAGS_DESCRIPTION |
|
||||
GXS_GROUP_FLAGS_DISTRIBUTION |
|
||||
// GXS_GROUP_FLAGS_PUBLISHSIGN |
|
||||
@ -37,21 +37,26 @@ const uint32_t AlbumCreateEnabledFlags = (
|
||||
GXS_GROUP_FLAGS_EXTRA |
|
||||
0);
|
||||
|
||||
// Album Requirements:
|
||||
// - All Photos require Publish signature (PUBLISH THREADS).
|
||||
// - Comments are in the threads - so these need Author signatures.
|
||||
// - Author signature required for all groups.
|
||||
uint32_t AlbumCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC |
|
||||
//GXS_GROUP_DEFAULTS_DISTRIB_GROUP |
|
||||
//GXS_GROUP_DEFAULTS_DISTRIB_LOCAL |
|
||||
|
||||
GXS_GROUP_DEFAULTS_PUBLISH_OPEN |
|
||||
//GXS_GROUP_DEFAULTS_PUBLISH_THREADS |
|
||||
//GXS_GROUP_DEFAULTS_PUBLISH_OPEN |
|
||||
GXS_GROUP_DEFAULTS_PUBLISH_THREADS |
|
||||
//GXS_GROUP_DEFAULTS_PUBLISH_REQUIRED |
|
||||
//GXS_GROUP_DEFAULTS_PUBLISH_ENCRYPTED |
|
||||
|
||||
//GXS_GROUP_DEFAULTS_PERSONAL_GPG |
|
||||
GXS_GROUP_DEFAULTS_PERSONAL_REQUIRED |
|
||||
//GXS_GROUP_DEFAULTS_PERSONAL_IFNOPUB |
|
||||
//GXS_GROUP_DEFAULTS_PERSONAL_REQUIRED |
|
||||
GXS_GROUP_DEFAULTS_PERSONAL_IFNOPUB |
|
||||
GXS_GROUP_DEFAULTS_PERSONAL_GROUP |
|
||||
|
||||
//GXS_GROUP_DEFAULTS_COMMENTS_YES |
|
||||
GXS_GROUP_DEFAULTS_COMMENTS_NO |
|
||||
GXS_GROUP_DEFAULTS_COMMENTS_YES |
|
||||
//GXS_GROUP_DEFAULTS_COMMENTS_NO |
|
||||
0);
|
||||
|
||||
uint32_t AlbumEditEnabledFlags = AlbumCreateEnabledFlags;
|
||||
@ -88,7 +93,8 @@ void AlbumGroupDialog::initUi()
|
||||
setUiText(UITYPE_CONTACTS_DOCK, tr("Select Album Admins"));
|
||||
|
||||
// Inject Extra Widgets.
|
||||
injectExtraWidget(new AlbumExtra(this));
|
||||
mAlbumExtra = new AlbumExtra(this);
|
||||
injectExtraWidget(mAlbumExtra);
|
||||
}
|
||||
|
||||
QPixmap AlbumGroupDialog::serviceImage()
|
||||
@ -115,11 +121,12 @@ void AlbumGroupDialog::prepareAlbumGroup(RsPhotoAlbum &group, const RsGroupMetaD
|
||||
group.mThumbnail.clear();
|
||||
}
|
||||
|
||||
// Additional Fields that we need to fill in.
|
||||
group.mCaption = "Caption goes here";
|
||||
group.mPhotographer = "photographer";
|
||||
group.mWhere = "Where?";
|
||||
|
||||
// Additional Fields.
|
||||
group.mShareMode = mAlbumExtra->getShareMode();
|
||||
group.mCaption = mAlbumExtra->getCaption();
|
||||
group.mPhotographer = mAlbumExtra->getPhotographer();
|
||||
group.mWhere = mAlbumExtra->getWhere();
|
||||
group.mWhen = mAlbumExtra->getWhen();
|
||||
}
|
||||
|
||||
bool AlbumGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta)
|
||||
@ -181,6 +188,12 @@ bool AlbumGroupDialog::service_loadGroup(uint32_t token, Mode /*mode*/, RsGroupM
|
||||
setLogo(QPixmap(":/images/album_create_64.png"));
|
||||
}
|
||||
|
||||
// NEED TO Load additional data....
|
||||
// Load additional data....
|
||||
mAlbumExtra->setShareMode(group.mShareMode);
|
||||
mAlbumExtra->setCaption(group.mCaption);
|
||||
mAlbumExtra->setPhotographer(group.mPhotographer);
|
||||
mAlbumExtra->setWhere(group.mWhere);
|
||||
mAlbumExtra->setWhen(group.mWhen);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include "gui/gxs/GxsGroupDialog.h"
|
||||
#include <retroshare/rsphoto.h>
|
||||
|
||||
#include "AlbumExtra.h"
|
||||
|
||||
class AlbumGroupDialog : public GxsGroupDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -42,6 +44,7 @@ protected:
|
||||
|
||||
private:
|
||||
void prepareAlbumGroup(RsPhotoAlbum &group, const RsGroupMetaData &meta);
|
||||
AlbumExtra *mAlbumExtra;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -55,7 +55,7 @@ PhotoDialog::~PhotoDialog()
|
||||
void PhotoDialog::setUp()
|
||||
{
|
||||
QPixmap qtn;
|
||||
qtn.loadFromData(mPhotoDetails.mThumbnail.mData, mPhotoDetails.mThumbnail.mSize, "PNG");
|
||||
qtn.loadFromData(mPhotoDetails.mLowResImage.mData, mPhotoDetails.mLowResImage.mSize);
|
||||
ui->label_Photo->setPixmap(qtn);
|
||||
ui->label_Photo->setVisible(true);
|
||||
|
||||
|
@ -48,16 +48,15 @@ class gridIndex
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#define DEFAULT_ORDER_INCREMENT (100)
|
||||
|
||||
PhotoDrop::PhotoDrop(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
:QWidget(parent), mLastOrder(0)
|
||||
{
|
||||
setAcceptDrops(true);
|
||||
|
||||
mSelected = NULL;
|
||||
checkMoveButtons();
|
||||
checkMoveButtons();
|
||||
reorderPhotos();
|
||||
}
|
||||
|
||||
@ -80,7 +79,7 @@ void PhotoDrop::resizeEvent ( QResizeEvent * event )
|
||||
reorderPhotos();
|
||||
}
|
||||
|
||||
int PhotoDrop::getPhotoCount()
|
||||
int PhotoDrop::getPhotoCount()
|
||||
{
|
||||
std::cerr << "PhotoDrop::getPhotoCount()";
|
||||
std::cerr << std::endl;
|
||||
@ -147,7 +146,7 @@ PhotoItem *PhotoDrop::getPhotoIdx(int idx)
|
||||
|
||||
void PhotoDrop::getPhotos(QSet<PhotoItem *> &photos)
|
||||
{
|
||||
photos = mPhotos;
|
||||
photos = mPhotos;
|
||||
}
|
||||
|
||||
|
||||
@ -453,7 +452,7 @@ void PhotoDrop::checkMoveButtons()
|
||||
int count = alayout->count();
|
||||
if ((!mSelected) || (count < 2))
|
||||
{
|
||||
buttonStatus(PHOTO_SHIFT_NO_BUTTONS);
|
||||
buttonStatus(PHOTO_SHIFT_NO_BUTTONS);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -462,7 +461,7 @@ void PhotoDrop::checkMoveButtons()
|
||||
{
|
||||
std::cerr << "PhotoDrop::checkMoveButtons() not GridLayout... not much we can do!";
|
||||
std::cerr << std::endl;
|
||||
buttonStatus(PHOTO_SHIFT_NO_BUTTONS);
|
||||
buttonStatus(PHOTO_SHIFT_NO_BUTTONS);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -477,15 +476,15 @@ void PhotoDrop::checkMoveButtons()
|
||||
int maxCol = (count - 1) % mColumns;
|
||||
if ((selectedRow == 0) && (selectedColumn == 0))
|
||||
{
|
||||
buttonStatus(PHOTO_SHIFT_RIGHT_ONLY);
|
||||
buttonStatus(PHOTO_SHIFT_RIGHT_ONLY);
|
||||
}
|
||||
else if ((selectedRow == maxRow) && (selectedColumn == maxCol))
|
||||
{
|
||||
buttonStatus(PHOTO_SHIFT_LEFT_ONLY);
|
||||
buttonStatus(PHOTO_SHIFT_LEFT_ONLY);
|
||||
}
|
||||
else
|
||||
{
|
||||
buttonStatus(PHOTO_SHIFT_BOTH);
|
||||
buttonStatus(PHOTO_SHIFT_BOTH);
|
||||
}
|
||||
}
|
||||
|
||||
@ -547,17 +546,6 @@ void PhotoDrop::dragEnterEvent(QDragEnterEvent *event)
|
||||
std::cerr << "PhotoDrop::dragEnterEvent()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
||||
#if 0
|
||||
const QStringList& formats = event->mimeData()->formats();
|
||||
std::cerr << "dragEnterEvent() Formats" << std::endl;
|
||||
QStringList::const_iterator it;
|
||||
for (it = formats.begin(); it != formats.end(); ++it) {
|
||||
std::cerr << "Format: " << (*it).toStdString();
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (event->mimeData()->hasUrls())
|
||||
{
|
||||
std::cerr << "PhotoDrop::dragEnterEvent() Accepting";
|
||||
@ -589,8 +577,8 @@ void PhotoDrop::dragMoveEvent(QDragMoveEvent *event)
|
||||
std::cerr << "PhotoDrop::dragMoveEvent()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
event->accept();
|
||||
//event->ignore();
|
||||
event->accept();
|
||||
//event->ignore();
|
||||
}
|
||||
|
||||
void PhotoDrop::dropEvent(QDropEvent *event)
|
||||
@ -611,11 +599,11 @@ void PhotoDrop::dropEvent(QDropEvent *event)
|
||||
std::cerr << "Whole URL: " << uit->toString().toStdString() << std::endl;
|
||||
std::cerr << "or As Local File: " << localpath.toStdString() << std::endl;
|
||||
|
||||
PhotoItem* item = new PhotoItem(mHolder, localpath);
|
||||
addPhotoItem(item);
|
||||
PhotoItem* item = new PhotoItem(mHolder, localpath, mLastOrder+DEFAULT_ORDER_INCREMENT);
|
||||
addPhotoItem(item);
|
||||
}
|
||||
event->setDropAction(Qt::CopyAction);
|
||||
event->accept();
|
||||
event->setDropAction(Qt::CopyAction);
|
||||
event->accept();
|
||||
|
||||
// Notify Listeners. (only happens for drop - not programmatically added).
|
||||
photosChanged();
|
||||
@ -624,17 +612,17 @@ void PhotoDrop::dropEvent(QDropEvent *event)
|
||||
{
|
||||
std::cerr << "PhotoDrop::dropEvent Ignoring";
|
||||
std::cerr << std::endl;
|
||||
event->ignore();
|
||||
event->ignore();
|
||||
}
|
||||
|
||||
checkMoveButtons();
|
||||
checkMoveButtons();
|
||||
|
||||
}
|
||||
|
||||
void PhotoDrop::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
/* see if this is in the space of one of our children */
|
||||
QPoint pos = event->pos();
|
||||
QPoint pos = event->pos();
|
||||
|
||||
std::cerr << "PhotoDrop::mousePressEvent(" << pos.x() << ", " << pos.y() << ")";
|
||||
std::cerr << std::endl;
|
||||
@ -644,7 +632,7 @@ void PhotoDrop::mousePressEvent(QMouseEvent *event)
|
||||
|
||||
void PhotoDrop::setPhotoItemHolder(PhotoShareItemHolder *holder)
|
||||
{
|
||||
mHolder = holder;
|
||||
mHolder = holder;
|
||||
}
|
||||
|
||||
void PhotoDrop::addPhotoItem(PhotoItem *item)
|
||||
@ -652,20 +640,25 @@ void PhotoDrop::addPhotoItem(PhotoItem *item)
|
||||
std::cerr << "PhotoDrop::addPhotoItem()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
mPhotos.insert(item);
|
||||
// record lastOrder number
|
||||
// so any new photos can be added after this.
|
||||
if (item->getPhotoDetails().mOrder > mLastOrder) {
|
||||
mLastOrder = item->getPhotoDetails().mOrder;
|
||||
}
|
||||
|
||||
mPhotos.insert(item);
|
||||
layout()->addWidget(item);
|
||||
|
||||
//checkMoveButtons();
|
||||
|
||||
//checkMoveButtons();
|
||||
}
|
||||
|
||||
bool PhotoDrop::deletePhoto(PhotoItem *item)
|
||||
{
|
||||
if(mPhotos.contains(item)){
|
||||
mPhotos.remove(item);
|
||||
layout()->removeWidget(item);
|
||||
delete item;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
if (mPhotos.contains(item)) {
|
||||
mPhotos.remove(item);
|
||||
layout()->removeWidget(item);
|
||||
delete item;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
PhotoItem *getPhotoIdx(int idx);
|
||||
void getPhotos(QSet<PhotoItem*>& photos);
|
||||
|
||||
void addPhotoItem(PhotoItem *item);
|
||||
void addPhotoItem(PhotoItem *item);
|
||||
void setPhotoItemHolder(PhotoShareItemHolder* holder);
|
||||
|
||||
/*!
|
||||
@ -91,8 +91,9 @@ private:
|
||||
|
||||
PhotoItem *mSelected;
|
||||
int mColumns;
|
||||
PhotoShareItemHolder* mHolder;
|
||||
QSet<PhotoItem*> mPhotos;
|
||||
PhotoShareItemHolder* mHolder;
|
||||
QSet<PhotoItem*> mPhotos;
|
||||
uint32_t mLastOrder;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -49,7 +49,7 @@ PhotoItem::PhotoItem(PhotoShareItemHolder *holder, const RsPhotoPhoto &photo, QW
|
||||
ui->idChooser->setVisible(false);
|
||||
}
|
||||
|
||||
PhotoItem::PhotoItem(PhotoShareItemHolder *holder, const QString& path, QWidget *parent) :
|
||||
PhotoItem::PhotoItem(PhotoShareItemHolder *holder, const QString& path, uint32_t order, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::PhotoItem), mHolder(holder)
|
||||
{
|
||||
@ -57,25 +57,20 @@ PhotoItem::PhotoItem(PhotoShareItemHolder *holder, const QString& path, QWidget
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
mPhotoDetails.mOrder = order;
|
||||
|
||||
QPixmap qtn = QPixmap(path);
|
||||
// TODO need to scale qtn to something reasonable.
|
||||
// shouldn't be call thumbnail... we can do a lowRes version.
|
||||
// do we need to to workout what type of file to convert to?
|
||||
// jpg, png etc.
|
||||
// seperate fn should handle all of this.
|
||||
mThumbNail = qtn.scaled(480,480, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
mLowResImage = qtn.scaled(512,512, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
|
||||
ui->label_Thumbnail->setPixmap(qtn.scaled(120, 120, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
ui->label_Thumbnail->setPixmap(qtn.scaled(128, 128, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
setSelected(false);
|
||||
|
||||
getThumbnail(mPhotoDetails.mThumbnail);
|
||||
getLowResImage(mPhotoDetails.mLowResImage);
|
||||
|
||||
connect(ui->lineEdit_Title, SIGNAL(editingFinished()), this, SLOT(setTitle()));
|
||||
connect(ui->lineEdit_PhotoGrapher, SIGNAL(editingFinished()), this, SLOT(setPhotoGrapher()));
|
||||
|
||||
ui->idChooser->loadIds(0, RsGxsId());
|
||||
|
||||
}
|
||||
|
||||
void PhotoItem::markForDeletion()
|
||||
@ -114,29 +109,6 @@ void PhotoItem::setSelected(bool selected)
|
||||
update();
|
||||
}
|
||||
|
||||
bool PhotoItem::getThumbnail(RsGxsImage &image)
|
||||
{
|
||||
const QPixmap *tmppix = &mThumbNail;
|
||||
|
||||
QByteArray ba;
|
||||
QBuffer buffer(&ba);
|
||||
|
||||
if(!tmppix->isNull())
|
||||
{
|
||||
// send chan image
|
||||
|
||||
buffer.open(QIODevice::WriteOnly);
|
||||
tmppix->save(&buffer, "PNG"); // writes image into ba in PNG format
|
||||
image.copy((uint8_t *) ba.data(), ba.size());
|
||||
return true;
|
||||
}
|
||||
|
||||
image.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PhotoItem::setTitle(){
|
||||
|
||||
mPhotoDetails.mMeta.mMsgName = ui->lineEdit_Title->text().toStdString();
|
||||
@ -144,13 +116,11 @@ void PhotoItem::setTitle(){
|
||||
|
||||
void PhotoItem::setPhotoGrapher()
|
||||
{
|
||||
mPhotoDetails.mPhotographer = ui->lineEdit_PhotoGrapher->text().toStdString();
|
||||
// mPhotoDetails.mPhotographer = ui->lineEdit_PhotoGrapher->text().toStdString();
|
||||
}
|
||||
|
||||
const RsPhotoPhoto& PhotoItem::getPhotoDetails()
|
||||
{
|
||||
|
||||
|
||||
if (ui->idChooser->isVisible()) {
|
||||
RsGxsId id;
|
||||
switch (ui->idChooser->getChosenId(id)) {
|
||||
@ -176,18 +146,34 @@ PhotoItem::~PhotoItem()
|
||||
|
||||
void PhotoItem::setUp()
|
||||
{
|
||||
|
||||
mTitleLabel = new QLabel();
|
||||
mPhotoGrapherLabel = new QLabel();
|
||||
|
||||
mTitleLabel->setText(QString::fromStdString(mPhotoDetails.mMeta.mMsgName));
|
||||
mPhotoGrapherLabel->setText(QString::fromStdString(mPhotoDetails.mPhotographer));
|
||||
|
||||
|
||||
ui->editLayOut->addWidget(mPhotoGrapherLabel);
|
||||
ui->editLayOut->addWidget(mTitleLabel);
|
||||
|
||||
updateImage(mPhotoDetails.mThumbnail);
|
||||
updateImage(mPhotoDetails.mLowResImage);
|
||||
}
|
||||
|
||||
bool PhotoItem::getLowResImage(RsGxsImage &image)
|
||||
{
|
||||
const QPixmap *tmppix = &mLowResImage;
|
||||
|
||||
QByteArray ba;
|
||||
QBuffer buffer(&ba);
|
||||
|
||||
if(!tmppix->isNull())
|
||||
{
|
||||
buffer.open(QIODevice::WriteOnly);
|
||||
tmppix->save(&buffer, "JPG");
|
||||
image.copy((uint8_t *) ba.data(), ba.size());
|
||||
return true;
|
||||
}
|
||||
|
||||
image.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
void PhotoItem::updateImage(const RsGxsImage &image)
|
||||
@ -195,9 +181,9 @@ void PhotoItem::updateImage(const RsGxsImage &image)
|
||||
if (image.mData != NULL)
|
||||
{
|
||||
QPixmap qtn;
|
||||
qtn.loadFromData(image.mData, image.mSize, "PNG");
|
||||
ui->label_Thumbnail->setPixmap(qtn.scaled(120, 120, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
mThumbNail = qtn;
|
||||
qtn.loadFromData(image.mData, image.mSize);
|
||||
ui->label_Thumbnail->setPixmap(qtn.scaled(128, 128, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
mLowResImage = qtn;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,12 +39,12 @@ public:
|
||||
enum State { New, Existing, Modified, Deleted };
|
||||
|
||||
PhotoItem(PhotoShareItemHolder *holder, const RsPhotoPhoto& photo, QWidget* parent = 0);
|
||||
PhotoItem(PhotoShareItemHolder *holder, const QString& path, QWidget* parent = 0); // for new photos.
|
||||
PhotoItem(PhotoShareItemHolder *holder, const QString& path, uint32_t order, QWidget* parent = 0); // for new photos.
|
||||
~PhotoItem();
|
||||
void setSelected(bool selected);
|
||||
bool isSelected(){ return mSelected; }
|
||||
const RsPhotoPhoto& getPhotoDetails();
|
||||
bool getThumbnail(RsGxsImage &image);
|
||||
bool getLowResImage(RsGxsImage &image);
|
||||
void markForDeletion();
|
||||
State getState() { return mState; }
|
||||
|
||||
@ -62,9 +62,9 @@ private:
|
||||
private:
|
||||
Ui::PhotoItem *ui;
|
||||
|
||||
QPixmap mThumbNail;
|
||||
QPixmap mLowResImage;
|
||||
|
||||
QPixmap getPixmap() { return mThumbNail; }
|
||||
QPixmap getPixmap() { return mLowResImage; }
|
||||
|
||||
bool mSelected;
|
||||
State mState;
|
||||
|
@ -436,7 +436,7 @@ void PhotoShare::addAlbum(const RsPhotoAlbum &album)
|
||||
|
||||
void PhotoShare::addPhoto(const RsPhotoPhoto &photo)
|
||||
{
|
||||
if (!photo.mThumbnail.empty())
|
||||
if (!photo.mLowResImage.empty())
|
||||
{
|
||||
PhotoItem* item = new PhotoItem(this, photo, this);
|
||||
mPhotoItems.insert(item);
|
||||
|
@ -179,10 +179,10 @@ void PhotoSlideShow::loadImage()
|
||||
if (ptr)
|
||||
{
|
||||
/* load into the slot */
|
||||
if (ptr->mThumbnail.mData != NULL)
|
||||
if (ptr->mLowResImage.mData != NULL)
|
||||
{
|
||||
QPixmap qtn;
|
||||
GxsIdDetails::loadPixmapFromData(ptr->mThumbnail.mData, ptr->mThumbnail.mSize,qtn, GxsIdDetails::ORIGINAL);
|
||||
GxsIdDetails::loadPixmapFromData(ptr->mLowResImage.mData, ptr->mLowResImage.mSize,qtn, GxsIdDetails::ORIGINAL);
|
||||
QPixmap sqtn = qtn.scaled(800, 600, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
ui.imgLabel->setPixmap(sqtn);
|
||||
|
||||
@ -221,6 +221,7 @@ void PhotoSlideShow::requestPhotos()
|
||||
{
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
||||
uint32_t token;
|
||||
std::list<RsGxsGroupId> grpIds;
|
||||
grpIds.push_back(mAlbum.mMeta.mGroupId);
|
||||
@ -248,8 +249,7 @@ bool PhotoSlideShow::loadPhotoData(const uint32_t &token)
|
||||
RsPhotoPhoto *ptr = new RsPhotoPhoto;
|
||||
*ptr = photo;
|
||||
|
||||
ptr->mThumbnail = photo.mThumbnail; // copies data.
|
||||
ptr->mOrder = i++;
|
||||
ptr->mLowResImage = photo.mLowResImage; // copies data.
|
||||
mPhotos[photo.mMeta.mMsgId] = ptr;
|
||||
mPhotoOrder[ptr->mOrder] = photo.mMeta.mMsgId;
|
||||
|
||||
|
@ -585,11 +585,11 @@ void GxsGroupDialog::editGroup()
|
||||
|
||||
RsGroupMetaData newMeta;
|
||||
newMeta.mGroupId = mGrpMeta.mGroupId;
|
||||
|
||||
if(!prepareGroupMetaData(newMeta))
|
||||
QString reason;
|
||||
if(!prepareGroupMetaData(newMeta, reason))
|
||||
{
|
||||
/* error message */
|
||||
QMessageBox::warning(this, "RetroShare", tr("Failed to Prepare Group MetaData - please Review"), QMessageBox::Ok, QMessageBox::Ok);
|
||||
QMessageBox::warning(this, "RetroShare", tr("Failed to Prepare Group MetaData: ") + reason, QMessageBox::Ok, QMessageBox::Ok);
|
||||
return; //Don't add a empty name!!
|
||||
}
|
||||
|
||||
@ -612,14 +612,22 @@ void GxsGroupDialog::editGroup()
|
||||
close();
|
||||
}
|
||||
|
||||
bool GxsGroupDialog::prepareGroupMetaData(RsGroupMetaData &meta)
|
||||
bool GxsGroupDialog::prepareGroupMetaData(RsGroupMetaData &meta, QString &reason)
|
||||
{
|
||||
std::cerr << "GxsGroupDialog::prepareGroupMetaData()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
// here would be the place to check for empty author id
|
||||
// but GXS_SERV::GRP_OPTION_AUTHEN_AUTHOR_SIGN is currently not used by any service
|
||||
|
||||
ui.idChooser->getChosenId(meta.mAuthorId);
|
||||
if ((mDefaultsFlags & GXS_GROUP_DEFAULTS_PERSONAL_GROUP) && (meta.mAuthorId.isNull())) {
|
||||
std::cerr << "GxsGroupDialog::prepareGroupMetaData()";
|
||||
std::cerr << " Group needs a Personal Signature";
|
||||
std::cerr << std::endl;
|
||||
reason = "Missing AuthorId";
|
||||
return false;
|
||||
}
|
||||
|
||||
QString name = getName();
|
||||
uint32_t flags = GXS_SERV::FLAG_PRIVACY_PUBLIC;
|
||||
@ -628,6 +636,7 @@ bool GxsGroupDialog::prepareGroupMetaData(RsGroupMetaData &meta)
|
||||
std::cerr << "GxsGroupDialog::prepareGroupMetaData()";
|
||||
std::cerr << " Invalid GroupName";
|
||||
std::cerr << std::endl;
|
||||
reason = "Missing GroupName";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -641,6 +650,7 @@ bool GxsGroupDialog::prepareGroupMetaData(RsGroupMetaData &meta)
|
||||
std::cerr << "GxsGroupDialog::prepareGroupMetaData()";
|
||||
std::cerr << " Invalid Circles";
|
||||
std::cerr << std::endl;
|
||||
reason = "Invalid Circle Parameters";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -668,10 +678,11 @@ void GxsGroupDialog::createGroup()
|
||||
|
||||
uint32_t token;
|
||||
RsGroupMetaData meta;
|
||||
if (!prepareGroupMetaData(meta))
|
||||
QString reason;
|
||||
if (!prepareGroupMetaData(meta, reason))
|
||||
{
|
||||
/* error message */
|
||||
QMessageBox::warning(this, "RetroShare", tr("Failed to Prepare Group MetaData - please Review"), QMessageBox::Ok, QMessageBox::Ok);
|
||||
QMessageBox::warning(this, "RetroShare", tr("Failed to Prepare Group MetaData: ") + reason, QMessageBox::Ok, QMessageBox::Ok);
|
||||
return; //Don't add with invalid circle.
|
||||
}
|
||||
|
||||
|
@ -84,10 +84,13 @@ public:
|
||||
#define GXS_GROUP_DEFAULTS_PERSONAL_PGP 0x00000100
|
||||
#define GXS_GROUP_DEFAULTS_PERSONAL_REQUIRED 0x00000200
|
||||
#define GXS_GROUP_DEFAULTS_PERSONAL_IFNOPUB 0x00000400
|
||||
// independent from other PERSONAL FLAGS. If Group requires a AuthorId.
|
||||
#define GXS_GROUP_DEFAULTS_PERSONAL_GROUP 0x00000800
|
||||
|
||||
#define GXS_GROUP_DEFAULTS_COMMENTS_YES 0x00001000
|
||||
#define GXS_GROUP_DEFAULTS_COMMENTS_NO 0x00002000
|
||||
|
||||
|
||||
#define GXS_GROUP_DEFAULTS_ANTISPAM_FAVOR_PGP 0x00100000
|
||||
#define GXS_GROUP_DEFAULTS_ANTISPAM_TRACK 0x00200000
|
||||
#define GXS_GROUP_DEFAULTS_ANTISPAM_FAVOR_PGP_KNOWN 0x00400000
|
||||
@ -271,7 +274,7 @@ private:
|
||||
void loadGroup(uint32_t token);
|
||||
void updateFromExistingMeta(const QString &description);
|
||||
|
||||
bool prepareGroupMetaData(RsGroupMetaData &meta);
|
||||
bool prepareGroupMetaData(RsGroupMetaData &meta, QString &reason);
|
||||
|
||||
std::list<std::string> mShareList;
|
||||
QPixmap mPicture;
|
||||
|
@ -1159,7 +1159,6 @@ gxsphotoshare {
|
||||
gui/PhotoShare/PhotoDrop.h \
|
||||
gui/PhotoShare/AlbumItem.h \
|
||||
gui/PhotoShare/AlbumDialog.h \
|
||||
gui/PhotoShare/AlbumCreateDialog.h \
|
||||
gui/PhotoShare/PhotoItem.h \
|
||||
gui/PhotoShare/PhotoShareItemHolder.h \
|
||||
gui/PhotoShare/PhotoShare.h \
|
||||
@ -1172,7 +1171,6 @@ gxsphotoshare {
|
||||
gui/PhotoShare/PhotoDialog.ui \
|
||||
gui/PhotoShare/AlbumItem.ui \
|
||||
gui/PhotoShare/AlbumDialog.ui \
|
||||
gui/PhotoShare/AlbumCreateDialog.ui \
|
||||
gui/PhotoShare/PhotoShare.ui \
|
||||
gui/PhotoShare/PhotoSlideShow.ui
|
||||
|
||||
@ -1184,7 +1182,6 @@ gxsphotoshare {
|
||||
gui/PhotoShare/PhotoDrop.cpp \
|
||||
gui/PhotoShare/AlbumItem.cpp \
|
||||
gui/PhotoShare/AlbumDialog.cpp \
|
||||
gui/PhotoShare/AlbumCreateDialog.cpp \
|
||||
gui/PhotoShare/PhotoShareItemHolder.cpp \
|
||||
gui/PhotoShare/PhotoShare.cpp \
|
||||
gui/PhotoShare/PhotoSlideShow.cpp
|
||||
|
@ -191,6 +191,15 @@ no_rs_service_webui_terminal_password:CONFIG -= rs_service_webui_terminal_passwo
|
||||
CONFIG *= rs_service_terminal_login
|
||||
no_rs_service_terminal_login:CONFIG -= rs_service_terminal_login
|
||||
|
||||
# To disable Diffie Hellman group check at init append the following assignation
|
||||
# to qmake command line "CONFIG+=no_rs_dh_init_check"
|
||||
# this check is not strictly needed and on some platform is very slow.
|
||||
# On Android it takes at least one minute at startup which is untolerable for
|
||||
# most phone users
|
||||
CONFIG+=rs_dh_init_check
|
||||
no_rs_dh_init_check:CONFIG -= rs_dh_init_check
|
||||
|
||||
|
||||
# Specify host precompiled jsonapi-generator path, appending the following
|
||||
# assignation to qmake command line
|
||||
# 'JSONAPI_GENERATOR_EXE=/myBuildDir/jsonapi-generator'. Required for JSON API
|
||||
@ -552,6 +561,8 @@ rs_use_native_dialogs:DEFINES *= RS_NATIVEDIALOGS
|
||||
|
||||
rs_broadcast_discovery:DEFINES *= RS_BROADCAST_DISCOVERY
|
||||
|
||||
no_rs_dh_init_check:DEFINES *= RS_DISABLE_DIFFIE_HELLMAN_INIT_CHECK
|
||||
|
||||
debug {
|
||||
QMAKE_CXXFLAGS -= -O2 -fomit-frame-pointer
|
||||
QMAKE_CFLAGS -= -O2 -fomit-frame-pointer
|
||||
|
Loading…
Reference in New Issue
Block a user