diff --git a/libretroshare/src/jsonapi/jsonapi.cpp b/libretroshare/src/jsonapi/jsonapi.cpp index 0c180ce52..f1e30881e 100644 --- a/libretroshare/src/jsonapi/jsonapi.cpp +++ b/libretroshare/src/jsonapi/jsonapi.cpp @@ -465,14 +465,17 @@ void JsonApiServer::registerHandler( const std::shared_ptr session, const std::function)>& 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; }; diff --git a/libretroshare/src/pqi/authssl.cc b/libretroshare/src/pqi/authssl.cc index 352c853e0..3365a6312 100644 --- a/libretroshare/src/pqi/authssl.cc +++ b/libretroshare/src/pqi/authssl.cc @@ -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 ; diff --git a/libretroshare/src/retroshare/rsgxscommon.h b/libretroshare/src/retroshare/rsgxscommon.h index 126c2b51f..723731e88 100644 --- a/libretroshare/src/retroshare/rsgxscommon.h +++ b/libretroshare/src/retroshare/rsgxscommon.h @@ -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 diff --git a/libretroshare/src/retroshare/rsphoto.h b/libretroshare/src/retroshare/rsphoto.h index 9c41e5377..8109164a7 100644 --- a/libretroshare/src/retroshare/rsphoto.h +++ b/libretroshare/src/retroshare/rsphoto.h @@ -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 > 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; } diff --git a/libretroshare/src/rs_upnp/upnphandler_miniupnp.cc b/libretroshare/src/rs_upnp/upnphandler_miniupnp.cc index 97b972cf1..ca21804af 100644 --- a/libretroshare/src/rs_upnp/upnphandler_miniupnp.cc +++ b/libretroshare/src/rs_upnp/upnphandler_miniupnp.cc @@ -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; } diff --git a/libretroshare/src/rs_upnp/upnphandler_miniupnp.h b/libretroshare/src/rs_upnp/upnphandler_miniupnp.h index d07304724..9449661e0 100644 --- a/libretroshare/src/rs_upnp/upnphandler_miniupnp.h +++ b/libretroshare/src/rs_upnp/upnphandler_miniupnp.h @@ -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 activeForwards; + RS_SET_CONTEXT_DEBUG_LEVEL(1) }; diff --git a/libretroshare/src/rsitems/rsphotoitems.cc b/libretroshare/src/rsitems/rsphotoitems.cc index 77a920fd6..f9200a83c 100644 --- a/libretroshare/src/rsitems/rsphotoitems.cc +++ b/libretroshare/src/rsitems/rsphotoitems.cc @@ -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(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(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(); } diff --git a/libretroshare/src/services/p3idservice.cc b/libretroshare/src/services/p3idservice.cc index 254d89db1..4d4d5ac5e 100644 --- a/libretroshare/src/services/p3idservice.cc +++ b/libretroshare/src/services/p3idservice.cc @@ -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; } } diff --git a/libretroshare/src/services/p3photoservice.cc b/libretroshare/src/services/p3photoservice.cc index 7a0e3bd9c..469fee65e 100644 --- a/libretroshare/src/services/p3photoservice.cc +++ b/libretroshare/src/services/p3photoservice.cc @@ -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; } diff --git a/libretroshare/src/util/retrodb.cc b/libretroshare/src/util/retrodb.cc index a539c1676..122f3e6a1 100644 --- a/libretroshare/src/util/retrodb.cc +++ b/libretroshare/src/util/retrodb.cc @@ -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; } diff --git a/retroshare-gui/src/gui/Identity/IdDialog.cpp b/retroshare-gui/src/gui/Identity/IdDialog.cpp index bf5502fea..d59b5bcf2 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.cpp +++ b/retroshare-gui/src/gui/Identity/IdDialog.cpp @@ -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 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 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& groupInfo) { #ifdef ID_DEBUG @@ -561,102 +623,27 @@ void IdDialog::loadCircles(const std::list& 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 clist = ui->treeWidget_membership->findItems( QString::fromStdString(vit->mGroupId.toStdString()), Qt::MatchExactly|Qt::MatchRecursive, CIRCLEGROUP_CIRCLE_COL_GROUPID); - QList 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& 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 */ diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.cpp b/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.cpp deleted file mode 100644 index 68c74e221..000000000 --- a/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/******************************************************************************* - * retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.cpp * - * * - * Copyright (C) 2018 by Retroshare Team * - * * - * 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 . * - * * - *******************************************************************************/ - -#include - -#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 photos; - - mPhotoDrop->getPhotos(photos); - - QSetIterator 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(selection); - - if(mPhotoSelected == NULL) - { - return; - } - else - { - mPhotoSelected->setSelected(false); - mPhotoSelected = pItem; - } - - mPhotoSelected->setSelected(true); -} diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.h b/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.h deleted file mode 100644 index d136a374b..000000000 --- a/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.h +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.h * - * * - * Copyright (C) 2018 by Retroshare Team * - * * - * 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 . * - * * - *******************************************************************************/ - -#ifndef ALBUMCREATEDIALOG_H -#define ALBUMCREATEDIALOG_H - -#include -#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 diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.ui b/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.ui deleted file mode 100644 index af5729fc9..000000000 --- a/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.ui +++ /dev/null @@ -1,539 +0,0 @@ - - - AlbumCreateDialog - - - - 0 - 0 - 643 - 550 - - - - Create Album - - - true - - - - 0 - - - 0 - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - 0 - - - - - - - QFrame::NoFrame - - - - 0 - - - 6 - - - - - 3 - - - - - Album Name: - - - - - - - - - - - 64 - 64 - - - - - 64 - 64 - - - - -border: 2px solid white; -border-radius: 10px; - - - - - - - - :/images/album_64.png:/images/album_64.png - - - - 64 - 64 - - - - - - - - Category: - - - - - - - - Animals - - - - - Family - - - - - Friends - - - - - Flowers - - - - - Holiday - - - - - Landscapes - - - - - Pets - - - - - Portraits - - - - - Travel - - - - - Work - - - - - Random - - - - - - - - Caption: - - - - - - - - - - Where: - - - - - - - - - - Photographer: - - - - - - - - - - Description: - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Horizontal - - - - - - - - - Qt::Horizontal - - - - - - - - 1 - 0 - - - - Share Options - - - - - - - - Policy: - - - - - - - Quality: - - - - - - - Comments: - - - - - - - Identity: - - - - - - - - - - - - 0 - 0 - - - - - Public - - - - - Restricted - - - - - - - - - 0 - 0 - - - - - Resize Images (< 1Mb) - - - - - Resize Images (< 10Mb) - - - - - Send Original Images - - - - - - - - - 0 - 0 - - - - - No Comments Allowed - - - - - Authenticated Comments - - - - - Any Comments Allowed - - - - - - - - - 0 - 0 - - - - - Publish with Identity - - - - - - - - - - Qt::Horizontal - - - - 168 - 20 - - - - - - - - - - - - - - - - - - - - <!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> - - - - - - - - 0 - 10 - - - - true - - - Qt::ScrollBarAsNeeded - - - true - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - 0 - 0 - 621 - 458 - - - - QWidget#scrollAreaWidgetContents{border: none;} - - - - - - - - - - - - - - - - 9 - - - - - Qt::Horizontal - - - - 419 - 18 - - - - - - - - QDialogButtonBox::Cancel - - - - - - - Back - - - - - - - Add Photos - - - - - - - Publish Album - - - - - - - - - - - HeaderFrame - QFrame -
gui/common/HeaderFrame.h
- 1 -
- - PhotoDrop - QWidget -
gui/PhotoShare/PhotoDrop.h
- 1 -
-
- - - - - - - buttonBox - rejected() - AlbumCreateDialog - close() - - - 353 - 529 - - - 321 - 274 - - - - -
diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumDialog.cpp b/retroshare-gui/src/gui/PhotoShare/AlbumDialog.cpp index 2115e5899..e163e7104 100644 --- a/retroshare-gui/src/gui/PhotoShare/AlbumDialog.cpp +++ b/retroshare-gui/src/gui/PhotoShare/AlbumDialog.cpp @@ -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& 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 ************************/ - - diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumExtra.cpp b/retroshare-gui/src/gui/PhotoShare/AlbumExtra.cpp index c6ddf6e17..010e7ded2 100644 --- a/retroshare-gui/src/gui/PhotoShare/AlbumExtra.cpp +++ b/retroshare-gui/src/gui/PhotoShare/AlbumExtra.cpp @@ -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(); +} + diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumExtra.h b/retroshare-gui/src/gui/PhotoShare/AlbumExtra.h index 1a932bcaa..bea24f4b3 100644 --- a/retroshare-gui/src/gui/PhotoShare/AlbumExtra.h +++ b/retroshare-gui/src/gui/PhotoShare/AlbumExtra.h @@ -24,21 +24,33 @@ #include 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 diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumExtra.ui b/retroshare-gui/src/gui/PhotoShare/AlbumExtra.ui index 09780a77a..23b0a462f 100644 --- a/retroshare-gui/src/gui/PhotoShare/AlbumExtra.ui +++ b/retroshare-gui/src/gui/PhotoShare/AlbumExtra.ui @@ -6,8 +6,8 @@ 0 0 - 513 - 198 + 516 + 199 @@ -21,119 +21,73 @@ - - - Category: - - - - - - - - Animals - - - - - Family - - - - - Friends - - - - - Flowers - - - - - Holiday - - - - - Landscapes - - - - - Pets - - - - - Portraits - - - - - Travel - - - - - Work - - - - - Random - - - - - Quality: - - + + 0 0 + + + Embedded Only (<50Kb) + + + + + Share Original Images + + + + + Copy Original Images (extra disk space) + + + + + Resize Images (< 200Kb) + + Resize Images (< 1Mb) - - - Resize Images (< 10Mb) - - - - - Send Original Images - - - + Qt::Horizontal - + Caption: + + + + + + + Photographer: + + + - + @@ -146,14 +100,14 @@ - + - Photographer: + When: - + diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumGroupDialog.cpp b/retroshare-gui/src/gui/PhotoShare/AlbumGroupDialog.cpp index 33e6cc229..760a6586f 100644 --- a/retroshare-gui/src/gui/PhotoShare/AlbumGroupDialog.cpp +++ b/retroshare-gui/src/gui/PhotoShare/AlbumGroupDialog.cpp @@ -26,8 +26,8 @@ #include 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; } diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumGroupDialog.h b/retroshare-gui/src/gui/PhotoShare/AlbumGroupDialog.h index a06ce3461..565363f85 100644 --- a/retroshare-gui/src/gui/PhotoShare/AlbumGroupDialog.h +++ b/retroshare-gui/src/gui/PhotoShare/AlbumGroupDialog.h @@ -25,6 +25,8 @@ #include "gui/gxs/GxsGroupDialog.h" #include +#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 diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoDialog.cpp b/retroshare-gui/src/gui/PhotoShare/PhotoDialog.cpp index 004c5d4cf..16ac8c4e7 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoDialog.cpp +++ b/retroshare-gui/src/gui/PhotoShare/PhotoDialog.cpp @@ -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); diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoDrop.cpp b/retroshare-gui/src/gui/PhotoShare/PhotoDrop.cpp index f092d2e02..d8fc76e0f 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoDrop.cpp +++ b/retroshare-gui/src/gui/PhotoShare/PhotoDrop.cpp @@ -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 &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; } diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoDrop.h b/retroshare-gui/src/gui/PhotoShare/PhotoDrop.h index 4b862eaf6..0b2ed55bc 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoDrop.h +++ b/retroshare-gui/src/gui/PhotoShare/PhotoDrop.h @@ -55,7 +55,7 @@ public: PhotoItem *getPhotoIdx(int idx); void getPhotos(QSet& 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 mPhotos; + PhotoShareItemHolder* mHolder; + QSet mPhotos; + uint32_t mLastOrder; }; #endif diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoItem.cpp b/retroshare-gui/src/gui/PhotoShare/PhotoItem.cpp index f98346e00..e30c321dd 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoItem.cpp +++ b/retroshare-gui/src/gui/PhotoShare/PhotoItem.cpp @@ -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; } } diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoItem.h b/retroshare-gui/src/gui/PhotoShare/PhotoItem.h index bdf03375e..376973a11 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoItem.h +++ b/retroshare-gui/src/gui/PhotoShare/PhotoItem.h @@ -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; diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoShare.cpp b/retroshare-gui/src/gui/PhotoShare/PhotoShare.cpp index 042430fa6..3fe022bde 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoShare.cpp +++ b/retroshare-gui/src/gui/PhotoShare/PhotoShare.cpp @@ -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); diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoSlideShow.cpp b/retroshare-gui/src/gui/PhotoShare/PhotoSlideShow.cpp index 3965bb79a..5213adc52 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoSlideShow.cpp +++ b/retroshare-gui/src/gui/PhotoShare/PhotoSlideShow.cpp @@ -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 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; diff --git a/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp index d5880dd90..ef0099faa 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp @@ -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. } diff --git a/retroshare-gui/src/gui/gxs/GxsGroupDialog.h b/retroshare-gui/src/gui/gxs/GxsGroupDialog.h index 709ad4d6f..49225dd1d 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupDialog.h +++ b/retroshare-gui/src/gui/gxs/GxsGroupDialog.h @@ -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 mShareList; QPixmap mPicture; diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro index 01bb92012..8806741ee 100644 --- a/retroshare-gui/src/retroshare-gui.pro +++ b/retroshare-gui/src/retroshare-gui.pro @@ -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 diff --git a/retroshare.pri b/retroshare.pri index 977bb84f7..6bccc1f5a 100644 --- a/retroshare.pri +++ b/retroshare.pri @@ -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