diff --git a/README.asciidoc b/README.asciidoc index 1243f0c28..28a3309e8 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -5,51 +5,51 @@ RetroShare is a decentralized, private, secure, cross-platform, communication toolkit. -RetroShare provides filesharing, chat, messages, forums, channels and more. +RetroShare provides file sharing, chat, messages, forums, channels and more. .Build Status |=============================================================================== -|GNU/Linux, MacOS, (via travis-ci) | image:https://travis-ci.org/RetroShare/RetroShare.svg?branch=master[link="https://travis-ci.org/RetroShare/RetroShare"] -|Windows (via appveyor) | image:https://ci.appveyor.com/api/projects/status/github/RetroShare/RetroShare?svg=true[link="https://ci.appveyor.com/project/RetroShare58622/retroshare"] +|GNU/Linux, macOS, (via Travis CI) | image:https://travis-ci.org/RetroShare/RetroShare.svg?branch=master[link="https://travis-ci.org/RetroShare/RetroShare"] +|Windows (via AppVeyor) | image:https://ci.appveyor.com/api/projects/status/github/RetroShare/RetroShare?svg=true[link="https://ci.appveyor.com/project/RetroShare58622/retroshare"] |=============================================================================== == Compilation -It is very difficult to keep a comprehensive (we support many platforms) and -updated documentation on how to build RetroShare, instead we provide scripts and -recipes that are used to create the packages for the supported platforms and -more in the `build_scripts` directory of this repository. +Short of comprehensive and updated documentation on how to build RetroShare +(for the many supported platforms it runs on), scripts and recipes are provided +in the aim of creating packages for the supported platforms (and more) +in the `build_scripts` directory of this repository. Those packaging receipts together with the continuous integration files `.travis.yml` and `appveyor.yml` are a good source of knowledge on how to compile RetroShare on different platforms. -== Using RetroShare on a headless computer with WebUI +== Using RetroShare on a headless computer with web UI -WARNING: This section is outdated need to be adapted to new WebUI +WARNING: This section is outdated need to be adapted to the new web UI -The webUI needs to be enabled as a parameter option in retroshare-service: +The web UI needs to be enabled as a parameter option to the retroshare-service: [source,bash] -------- ./retroshare-nogui --webinterface 9090 --docroot /usr/share/retroshare/webui/ -------- -The webUI is only accessible on localhost:9090. It is advised to keep it that way so that your RS +The web UI is only accessible on localhost:9090. It is advised to keep it that way so that your RS cannot be controlled using an untrusted connection. -To access your web UI from a distance, just open a SSH tunnel on it: +To access your web UI from a distance, just open a SSH tunnel to it: [source,bash] -------- distant_machine:~/ > ssh rs_host -L 9090:localhost:9090 -N -------- -"rs_host" is the machine running retroshare-nogui. Then on the distant machine, access your webUI on +"rs_host" is the machine running `retroshare-nogui`. Then on the distant machine, access your web UI on http://localhost:9090 -That also works with a retroshare GUI of course. +(This can also be done from the RetroShare GUI.) diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro index cc4e1dc11..ce8b8dff2 100644 --- a/libretroshare/src/libretroshare.pro +++ b/libretroshare/src/libretroshare.pro @@ -20,6 +20,11 @@ DESTDIR = lib #QMAKE_CFLAGS += -Werror #QMAKE_CXXFLAGS += -Werror +## Uncomment to enable Unfinished Services. +#CONFIG += wikipoos +#CONFIG += gxsthewire +#CONFIG += gxsphotoshare + debug { # DEFINES *= DEBUG # DEFINES *= OPENDHT_DEBUG DHT_DEBUG CONN_DEBUG DEBUG_UDP_SORTER P3DISC_DEBUG DEBUG_UDP_LAYER FT_DEBUG EXTADDRSEARCH_DEBUG @@ -763,6 +768,8 @@ SOURCES += services/p3gxschannels.cc \ rsitems/rsgxschannelitems.cc \ wikipoos { + DEFINES *= RS_USE_WIKI + # Wiki Service HEADERS += retroshare/rswiki.h \ services/p3wiki.h \ @@ -773,6 +780,8 @@ wikipoos { } gxsthewire { + DEFINES *= RS_USE_WIRE + # Wire Service HEADERS += retroshare/rswire.h \ services/p3wire.h \ @@ -793,6 +802,8 @@ SOURCES += services/p3postbase.cc \ rsitems/rsposteditems.cc gxsphotoshare { + DEFINES *= RS_USE_PHOTO + #Photo Service HEADERS += services/p3photoservice.h \ retroshare/rsphoto.h \ diff --git a/libretroshare/src/retroshare/rsgxschannels.h b/libretroshare/src/retroshare/rsgxschannels.h index 615ff30f7..6f14552c2 100644 --- a/libretroshare/src/retroshare/rsgxschannels.h +++ b/libretroshare/src/retroshare/rsgxschannels.h @@ -512,10 +512,10 @@ public: RS_DEPRECATED_FOR(getChannelsInfo) virtual bool getGroupData(const uint32_t &token, std::vector &groups) = 0; - RS_DEPRECATED_FOR(getChannelsContent) + RS_DEPRECATED_FOR(getChannelContent) virtual bool getPostData(const uint32_t &token, std::vector &posts, std::vector &cmts) = 0; - RS_DEPRECATED_FOR(getChannelsContent) + RS_DEPRECATED_FOR(getChannelContent) virtual bool getPostData(const uint32_t &token, std::vector &posts) = 0; /** diff --git a/libretroshare/src/retroshare/rsphoto.h b/libretroshare/src/retroshare/rsphoto.h index 7e5b6ea99..f94f50f34 100644 --- a/libretroshare/src/retroshare/rsphoto.h +++ b/libretroshare/src/retroshare/rsphoto.h @@ -3,7 +3,7 @@ * * * libretroshare: retroshare core library * * * - * Copyright 2008-2012 by Robert Fernie * + * Copyright 2008-2020 by Robert Fernie * * * * This program is free software: you can redistribute it and/or modify * * it under the terms of the GNU Lesser General Public License as * @@ -26,6 +26,7 @@ #include #include #include "rsgxsservice.h" +#include "rsgxscommon.h" /* The Main Interface Class - for information about your Peers */ class RsPhoto; @@ -37,21 +38,6 @@ extern RsPhoto *rsPhoto; #define RSPHOTO_MODE_OWN 2 #define RSPHOTO_MODE_REMOTE 3 -class RsPhotoThumbnail -{ - public: - RsPhotoThumbnail() - :data(NULL), size(0), type("N/A") { return; } - - bool deleteImage(); - bool copyFrom(const RsPhotoThumbnail &nail); - - // Holds Thumbnail image. - uint8_t *data; - uint32_t size; - std::string type; -}; - /* If these flags are no set - the Photo inherits values from the Album */ @@ -96,7 +82,7 @@ class RsPhotoPhoto int mOrder; - RsPhotoThumbnail mThumbnail; + RsGxsImage mThumbnail; int mMode; @@ -137,7 +123,7 @@ class RsPhotoAlbum std::string mHashTags; - RsPhotoThumbnail mThumbnail; + RsGxsImage mThumbnail; int mMode; diff --git a/libretroshare/src/rsitems/rsphotoitems.cc b/libretroshare/src/rsitems/rsphotoitems.cc index e462d8ee9..2791b668c 100644 --- a/libretroshare/src/rsitems/rsphotoitems.cc +++ b/libretroshare/src/rsitems/rsphotoitems.cc @@ -26,39 +26,34 @@ #include "serialiser/rstlvbinary.h" #include "serialiser/rstypeserializer.h" -#define GXS_PHOTO_SERIAL_DEBUG - - RsItem *RsGxsPhotoSerialiser::create_item(uint16_t service, uint8_t item_sub_id) const { - if(service != RS_SERVICE_GXS_TYPE_PHOTO) - return NULL ; + if(service != RS_SERVICE_GXS_TYPE_PHOTO) + return NULL ; - switch(item_sub_id) - { - case RS_PKT_SUBTYPE_PHOTO_COMMENT_ITEM: return new RsGxsPhotoCommentItem() ; - case RS_PKT_SUBTYPE_PHOTO_SHOW_ITEM: return new RsGxsPhotoAlbumItem() ; - case RS_PKT_SUBTYPE_PHOTO_ITEM: return new RsGxsPhotoPhotoItem() ; - default: - return NULL ; - } + switch(item_sub_id) + { + case RS_PKT_SUBTYPE_PHOTO_COMMENT_ITEM: return new RsGxsPhotoCommentItem() ; + case RS_PKT_SUBTYPE_PHOTO_SHOW_ITEM: return new RsGxsPhotoPhotoItem() ; + case RS_PKT_SUBTYPE_PHOTO_ITEM: return new RsGxsPhotoAlbumItem() ; + default: + return NULL ; + } } void RsGxsPhotoAlbumItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) { - 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_PIC_TYPE, album.mThumbnail.type,"mThumbnail.type"); + 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"); - RsTlvBinaryDataRef b(RS_SERVICE_GXS_TYPE_PHOTO, album.mThumbnail.data, album.mThumbnail.size); - RsTypeSerializer::serial_process(j, ctx, b, "thumbnail binary data") ; + album.mThumbnail.serial_process(j, ctx); } void RsGxsPhotoPhotoItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) { @@ -70,15 +65,13 @@ void RsGxsPhotoPhotoItem::serial_process(RsGenericSerializer::SerializeJob j,RsG 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"); - RsTypeSerializer::serial_process(j, ctx, TLV_TYPE_STR_PIC_TYPE, photo.mThumbnail.type, "mThumbnail.type"); - RsTlvBinaryDataRef b(RS_SERVICE_GXS_TYPE_PHOTO, photo.mThumbnail.data, photo.mThumbnail.size); - RsTypeSerializer::serial_process(j, ctx, b, "mThumbnail") ; + photo.mThumbnail.serial_process(j, ctx); } void RsGxsPhotoCommentItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) { - RsTypeSerializer::serial_process (j,ctx,TLV_TYPE_STR_COMMENT,comment.mComment,"mComment"); - RsTypeSerializer::serial_process(j,ctx,comment.mCommentFlag,"mCommentFlag"); + RsTypeSerializer::serial_process (j,ctx,TLV_TYPE_STR_COMMENT,comment.mComment,"mComment"); + RsTypeSerializer::serial_process(j,ctx,comment.mCommentFlag,"mCommentFlag"); } void RsGxsPhotoAlbumItem::clear() @@ -92,13 +85,13 @@ void RsGxsPhotoAlbumItem::clear() album.mPhotographer.clear(); album.mWhen.clear(); album.mWhere.clear(); - album.mThumbnail.deleteImage(); + album.mThumbnail.clear(); } void RsGxsPhotoCommentItem::clear() { - comment.mComment.clear(); - comment.mCommentFlag = 0; + comment.mComment.clear(); + comment.mCommentFlag = 0; } void RsGxsPhotoPhotoItem::clear() @@ -111,5 +104,5 @@ void RsGxsPhotoPhotoItem::clear() photo.mPhotographer.clear(); photo.mWhen.clear(); photo.mWhere.clear(); - photo.mThumbnail.deleteImage(); + photo.mThumbnail.clear(); } diff --git a/libretroshare/src/rsitems/rswireitems.cc b/libretroshare/src/rsitems/rswireitems.cc index eb3896f17..c00012975 100644 --- a/libretroshare/src/rsitems/rswireitems.cc +++ b/libretroshare/src/rsitems/rswireitems.cc @@ -51,6 +51,12 @@ void RsGxsWireGroupItem::serial_process(RsGenericSerializer::SerializeJob j,RsGe RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_DESCR,group.mDescription,"group.mDescription") ; } +void RsGxsWirePulseItem::clear() +{ + pulse.mPulseText.clear(); + pulse.mHashTags.clear(); +} + void RsGxsWirePulseItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) { RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_MSG,pulse.mPulseText,"pulse.mPulseText") ; diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 2de431589..886660049 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -737,12 +737,13 @@ RsGRouter *rsGRouter = NULL ; #include "pgp/pgpauxutils.h" #include "services/p3idservice.h" #include "services/p3gxscircles.h" -#include "services/p3wiki.h" #include "services/p3posted.h" -#include "services/p3photoservice.h" #include "services/p3gxsforums.h" #include "services/p3gxschannels.h" + +#include "services/p3wiki.h" #include "services/p3wire.h" +#include "services/p3photoservice.h" #endif // RS_ENABLE_GXS @@ -1361,35 +1362,35 @@ int RsServer::StartupRetroShare() mGxsChannels->setNetworkExchangeService(gxschannels_ns) ; -#if 0 // PHOTO IS DISABLED FOR THE MOMENT +#ifdef RS_USE_PHOTO /**** Photo service ****/ RsGeneralDataService* photo_ds = new RsDataService(currGxsDir + "/", "photoV2_db", RS_SERVICE_GXS_TYPE_PHOTO, NULL, rsInitConfig->gxs_passwd); // init gxs services - mPhoto = new p3PhotoService(photo_ds, NULL, mGxsIdService); + p3PhotoService *mPhoto = new p3PhotoService(photo_ds, NULL, mGxsIdService); // create GXS photo service RsGxsNetService* photo_ns = new RsGxsNetService( RS_SERVICE_GXS_TYPE_PHOTO, photo_ds, nxsMgr, mPhoto, mPhoto->getServiceInfo(), - mGxsIdService, mGxsCircles,mGxsIdService, + mReputations, mGxsCircles,mGxsIdService, pgpAuxUtils); #endif -#if 0 // WIRE IS DISABLED FOR THE MOMENT +#ifdef RS_USE_WIRE /**** Wire GXS service ****/ RsGeneralDataService* wire_ds = new RsDataService(currGxsDir + "/", "wire_db", RS_SERVICE_GXS_TYPE_WIRE, NULL, rsInitConfig->gxs_passwd); - mWire = new p3Wire(wire_ds, NULL, mGxsIdService); + p3Wire *mWire = new p3Wire(wire_ds, NULL, mGxsIdService); // create GXS photo service RsGxsNetService* wire_ns = new RsGxsNetService( RS_SERVICE_GXS_TYPE_WIRE, wire_ds, nxsMgr, mWire, mWire->getServiceInfo(), - mGxsIdService, mGxsCircles,mGxsIdService, + mReputations, mGxsCircles,mGxsIdService, pgpAuxUtils); #endif // now add to p3service @@ -1401,7 +1402,12 @@ int RsServer::StartupRetroShare() #endif pqih->addService(gxsforums_ns, true); pqih->addService(gxschannels_ns, true); - //pqih->addService(photo_ns, true); +#ifdef RS_USE_PHOTO + pqih->addService(photo_ns, true); +#endif +#ifdef RS_USE_WIRE + pqih->addService(wire_ns, true); +#endif # ifdef RS_GXS_TRANS RsGeneralDataService* gxstrans_ds = new RsDataService( @@ -1630,8 +1636,12 @@ int RsServer::StartupRetroShare() #ifdef RS_USE_WIKI mConfigMgr->addConfiguration("wiki.cfg", wiki_ns); #endif - //mConfigMgr->addConfiguration("photo.cfg", photo_ns); - //mConfigMgr->addConfiguration("wire.cfg", wire_ns); +#ifdef RS_USE_PHOTO + mConfigMgr->addConfiguration("photo.cfg", photo_ns); +#endif +#ifdef RS_USE_WIRE + mConfigMgr->addConfiguration("wire.cfg", wire_ns); +#endif #endif //RS_ENABLE_GXS mConfigMgr->addConfiguration("I2PBOB.cfg", mI2pBob); @@ -1793,8 +1803,12 @@ int RsServer::StartupRetroShare() rsGxsChannels = mGxsChannels; rsGxsTrans = mGxsTrans; - //rsPhoto = mPhoto; - //rsWire = mWire; +#if RS_USE_PHOTO + rsPhoto = mPhoto; +#endif +#if RS_USE_WIRE + rsWire = mWire; +#endif /*** start up GXS core runner ***/ @@ -1808,8 +1822,12 @@ int RsServer::StartupRetroShare() startServiceThread(mGxsForums, "gxs forums"); startServiceThread(mGxsChannels, "gxs channels"); - //createThread(*mPhoto); - //createThread(*mWire); +#if RS_USE_PHOTO + startServiceThread(mPhoto, "gxs photo"); +#endif +#if RS_USE_WIRE + startServiceThread(mPhoto, "gxs wire"); +#endif // cores ready start up GXS net servers startServiceThread(gxsid_ns, "gxs id ns"); @@ -1821,8 +1839,12 @@ int RsServer::StartupRetroShare() startServiceThread(gxsforums_ns, "gxs forums ns"); startServiceThread(gxschannels_ns, "gxs channels ns"); - //createThread(*photo_ns); - //createThread(*wire_ns); +#if RS_USE_PHOTO + startServiceThread(photo_ns, "gxs photo ns"); +#endif +#if RS_USE_WIRE + startServiceThread(photo_ns, "gxs wire ns"); +#endif # ifdef RS_GXS_TRANS startServiceThread(mGxsTrans, "gxs trans"); diff --git a/libretroshare/src/services/p3photoservice.cc b/libretroshare/src/services/p3photoservice.cc index 608fddbc0..72402ddf8 100644 --- a/libretroshare/src/services/p3photoservice.cc +++ b/libretroshare/src/services/p3photoservice.cc @@ -26,140 +26,100 @@ RsPhoto *rsPhoto = NULL; -const uint32_t RsPhoto::FLAG_MSG_TYPE_MASK = 0x000f; +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; - - - -bool RsPhotoThumbnail::copyFrom(const RsPhotoThumbnail &nail) -{ - if (data) - { - deleteImage(); - } - - if ((!nail.data) || (nail.size == 0)) - { - return false; - } - - size = nail.size; - type = nail.type; - data = (uint8_t *) rs_malloc(size); - - if(data == NULL) - return false ; - - memcpy(data, nail.data, size); - - return true; -} - -bool RsPhotoThumbnail::deleteImage() -{ - if (data) - { - free(data); - data = NULL; - size = 0; - type.clear(); - } - return true; -} - - RsPhotoPhoto::RsPhotoPhoto() - :mSetFlags(0), mOrder(0), mMode(0), mModFlags(0) + :mSetFlags(0), mOrder(0), mMode(0), mModFlags(0) { - return; + return; } RsPhotoAlbum::RsPhotoAlbum() - :mMode(0), mSetFlags(0), mModFlags(0) + :mMode(0), mSetFlags(0), mModFlags(0) { - return; + return; } RsPhotoComment::RsPhotoComment() - : mComment(""), mCommentFlag(0) { + : mComment(""), mCommentFlag(0) { } RsPhotoComment::RsPhotoComment(const RsGxsPhotoCommentItem &comment) - : mComment(""), mCommentFlag(0) { + : mComment(""), mCommentFlag(0) { - *this = comment.comment; - (*this).mMeta = comment.meta; + *this = comment.comment; + (*this).mMeta = comment.meta; } std::ostream &operator<<(std::ostream &out, const RsPhotoPhoto &photo) { - out << "RsPhotoPhoto [ "; - out << "Title: " << photo.mMeta.mMsgName; - out << "]"; - return out; + out << "RsPhotoPhoto [ "; + out << "Title: " << photo.mMeta.mMsgName; + out << "]"; + return out; } std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album) { - out << "RsPhotoAlbum [ "; - out << "Title: " << album.mMeta.mGroupName; - out << "]"; - return out; + out << "RsPhotoAlbum [ "; + out << "Title: " << album.mMeta.mGroupName; + out << "]"; + return out; } p3PhotoService::p3PhotoService(RsGeneralDataService* gds, RsNetworkExchangeService* nes, RsGixs* gixs) - : RsGenExchange(gds, nes, new RsGxsPhotoSerialiser(), RS_SERVICE_GXS_TYPE_PHOTO, gixs, photoAuthenPolicy()), - mPhotoMutex(std::string("Photo Mutex")) + : RsGenExchange(gds, nes, new RsGxsPhotoSerialiser(), RS_SERVICE_GXS_TYPE_PHOTO, gixs, photoAuthenPolicy()), + mPhotoMutex(std::string("Photo Mutex")) { } const std::string GXS_PHOTO_APP_NAME = "gxsphoto"; -const uint16_t GXS_PHOTO_APP_MAJOR_VERSION = 1; -const uint16_t GXS_PHOTO_APP_MINOR_VERSION = 0; -const uint16_t GXS_PHOTO_MIN_MAJOR_VERSION = 1; -const uint16_t GXS_PHOTO_MIN_MINOR_VERSION = 0; +const uint16_t GXS_PHOTO_APP_MAJOR_VERSION = 1; +const uint16_t GXS_PHOTO_APP_MINOR_VERSION = 0; +const uint16_t GXS_PHOTO_MIN_MAJOR_VERSION = 1; +const uint16_t GXS_PHOTO_MIN_MINOR_VERSION = 0; RsServiceInfo p3PhotoService::getServiceInfo() { - return RsServiceInfo(RS_SERVICE_GXS_TYPE_PHOTO, - GXS_PHOTO_APP_NAME, - GXS_PHOTO_APP_MAJOR_VERSION, - GXS_PHOTO_APP_MINOR_VERSION, - GXS_PHOTO_MIN_MAJOR_VERSION, - GXS_PHOTO_MIN_MINOR_VERSION); + return RsServiceInfo(RS_SERVICE_GXS_TYPE_PHOTO, + GXS_PHOTO_APP_NAME, + GXS_PHOTO_APP_MAJOR_VERSION, + GXS_PHOTO_APP_MINOR_VERSION, + GXS_PHOTO_MIN_MAJOR_VERSION, + GXS_PHOTO_MIN_MINOR_VERSION); } uint32_t p3PhotoService::photoAuthenPolicy() { - uint32_t policy = 0; - uint8_t flag = 0; + uint32_t policy = 0; + uint8_t flag = 0; - flag = GXS_SERV::MSG_AUTHEN_ROOT_PUBLISH_SIGN | GXS_SERV::MSG_AUTHEN_CHILD_AUTHOR_SIGN; - RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PUBLIC_GRP_BITS); + flag = GXS_SERV::MSG_AUTHEN_ROOT_PUBLISH_SIGN | GXS_SERV::MSG_AUTHEN_CHILD_AUTHOR_SIGN; + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PUBLIC_GRP_BITS); - flag |= GXS_SERV::MSG_AUTHEN_CHILD_PUBLISH_SIGN; - RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::RESTRICTED_GRP_BITS); - RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PRIVATE_GRP_BITS); + flag |= GXS_SERV::MSG_AUTHEN_CHILD_PUBLISH_SIGN; + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::RESTRICTED_GRP_BITS); + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PRIVATE_GRP_BITS); - flag = GXS_SERV::GRP_OPTION_AUTHEN_AUTHOR_SIGN; - RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::GRP_OPTION_BITS); + flag = GXS_SERV::GRP_OPTION_AUTHEN_AUTHOR_SIGN; + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::GRP_OPTION_BITS); - return policy; + return policy; } bool p3PhotoService::updated() { - RsStackMutex stack(mPhotoMutex); + RsStackMutex stack(mPhotoMutex); - bool changed = (!mGroupChange.empty() || !mMsgChange.empty()); + bool changed = (!mGroupChange.empty() || !mMsgChange.empty()); - return changed; + return changed; } void p3PhotoService::service_tick() @@ -171,33 +131,34 @@ void p3PhotoService::service_tick() void p3PhotoService::groupsChanged(std::list& grpIds) { - RsStackMutex stack(mPhotoMutex); + RsStackMutex stack(mPhotoMutex); - while(!mGroupChange.empty()) - { - RsGxsGroupChange* gc = mGroupChange.back(); - std::list& gList = gc->mGrpIdList; - std::list::iterator lit = gList.begin(); - for(; lit != gList.end(); ++lit) - grpIds.push_back(*lit); + while(!mGroupChange.empty()) + { + RsGxsGroupChange* gc = mGroupChange.back(); + std::list& gList = gc->mGrpIdList; + std::list::iterator lit = gList.begin(); + for(; lit != gList.end(); ++lit) { + grpIds.push_back(*lit); + } - mGroupChange.pop_back(); - delete gc; - } + mGroupChange.pop_back(); + delete gc; + } } void p3PhotoService::msgsChanged(GxsMsgIdResult& msgs) { - RsStackMutex stack(mPhotoMutex); + RsStackMutex stack(mPhotoMutex); - while(!mMsgChange.empty()) - { - RsGxsMsgChange* mc = mMsgChange.back(); - msgs = mc->msgChangeMap; - mMsgChange.pop_back(); - delete mc; - } + while(!mMsgChange.empty()) + { + RsGxsMsgChange* mc = mMsgChange.back(); + msgs = mc->msgChangeMap; + mMsgChange.pop_back(); + delete mc; + } } @@ -210,7 +171,8 @@ RsTokenService* p3PhotoService::getTokenService() { bool p3PhotoService::getGroupList(const uint32_t& token, std::list& groupIds) { - return RsGenExchange::getGroupList(token, groupIds); + bool okay = RsGenExchange::getGroupList(token, groupIds); + return okay; } @@ -225,7 +187,8 @@ bool p3PhotoService::getMsgList(const uint32_t& token, bool p3PhotoService::getGroupSummary(const uint32_t& token, std::list& groupInfo) { - return RsGenExchange::getGroupMeta(token, groupInfo); + bool okay = RsGenExchange::getGroupMeta(token, groupInfo); + return okay; } @@ -306,61 +269,59 @@ bool p3PhotoService::getPhoto(const uint32_t& token, PhotoResult& photos) bool p3PhotoService::getPhotoComment(const uint32_t &token, PhotoCommentResult &comments) { - GxsMsgDataMap msgData; - bool ok = RsGenExchange::getMsgData(token, msgData); + GxsMsgDataMap msgData; + bool ok = RsGenExchange::getMsgData(token, msgData); - if(ok) - { - GxsMsgDataMap::iterator mit = msgData.begin(); + if(ok) + { + GxsMsgDataMap::iterator mit = msgData.begin(); - for(; mit != msgData.end(); ++mit) - { - RsGxsGroupId grpId = mit->first; - std::vector& msgItems = mit->second; - std::vector::iterator vit = msgItems.begin(); + for(; mit != msgData.end(); ++mit) + { + RsGxsGroupId grpId = mit->first; + std::vector& msgItems = mit->second; + std::vector::iterator vit = msgItems.begin(); - for(; vit != msgItems.end(); ++vit) - { - RsGxsPhotoCommentItem* item = dynamic_cast(*vit); + for(; vit != msgItems.end(); ++vit) + { + RsGxsPhotoCommentItem* item = dynamic_cast(*vit); - if(item) - { - RsPhotoComment comment = item->comment; - comment.mMeta = item->meta; - comments[grpId].push_back(comment); - delete item; - }else - { - std::cerr << "Not a comment Item, deleting!" << std::endl; - delete *vit; - } - } - } - } + if(item) + { + RsPhotoComment comment = item->comment; + comment.mMeta = item->meta; + comments[grpId].push_back(comment); + delete item; + }else + { + std::cerr << "Not a comment Item, deleting!" << std::endl; + delete *vit; + } + } + } + } - return ok; + return ok; } RsPhotoComment& RsPhotoComment::operator=(const RsGxsPhotoCommentItem& comment) { - *this = comment.comment; - return *this; + *this = comment.comment; + return *this; } bool p3PhotoService::getPhotoRelatedComment(const uint32_t &token, PhotoRelatedCommentResult &comments) { - - return RsGenExchange::getMsgRelatedDataT(token, comments); - + return RsGenExchange::getMsgRelatedDataT(token, comments); } bool p3PhotoService::submitAlbumDetails(uint32_t& token, RsPhotoAlbum& album) { - RsGxsPhotoAlbumItem* albumItem = new RsGxsPhotoAlbumItem(); - albumItem->album = album; - albumItem->meta = album.mMeta; - RsGenExchange::publishGroup(token, albumItem); - return true; + RsGxsPhotoAlbumItem* albumItem = new RsGxsPhotoAlbumItem(); + albumItem->album = album; + albumItem->meta = album.mMeta; + RsGenExchange::publishGroup(token, albumItem); + return true; } @@ -368,28 +329,28 @@ bool p3PhotoService::submitAlbumDetails(uint32_t& token, RsPhotoAlbum& album) void p3PhotoService::notifyChanges(std::vector& changes) { - RsStackMutex stack(mPhotoMutex); + RsStackMutex stack(mPhotoMutex); - std::vector::iterator vit = changes.begin(); + std::vector::iterator vit = changes.begin(); - for(; vit != changes.end(); ++vit) - { - RsGxsNotify* n = *vit; - RsGxsGroupChange* gc; - RsGxsMsgChange* mc; - if((mc = dynamic_cast(n)) != NULL) - { - mMsgChange.push_back(mc); - } - else if((gc = dynamic_cast(n)) != NULL) - { - mGroupChange.push_back(gc); - } - else - { - delete n; - } - } + for(; vit != changes.end(); ++vit) + { + RsGxsNotify* n = *vit; + RsGxsGroupChange* gc; + RsGxsMsgChange* mc; + if((mc = dynamic_cast(n)) != NULL) + { + mMsgChange.push_back(mc); + } + else if((gc = dynamic_cast(n)) != NULL) + { + mGroupChange.push_back(gc); + } + else + { + delete n; + } + } } bool p3PhotoService::submitPhoto(uint32_t& token, RsPhotoPhoto& photo) @@ -397,21 +358,20 @@ bool p3PhotoService::submitPhoto(uint32_t& token, RsPhotoPhoto& photo) RsGxsPhotoPhotoItem* photoItem = new RsGxsPhotoPhotoItem(); photoItem->photo = photo; photoItem->meta = photo.mMeta; - photoItem->meta.mMsgFlags = FLAG_MSG_TYPE_PHOTO_POST; - RsGenExchange::publishMsg(token, photoItem); - return true; + RsGenExchange::publishMsg(token, photoItem); + return true; } bool p3PhotoService::submitComment(uint32_t &token, RsPhotoComment &comment) { - RsGxsPhotoCommentItem* commentItem = new RsGxsPhotoCommentItem(); - commentItem->comment = comment; - commentItem->meta = comment.mMeta; - commentItem->meta.mMsgFlags = FLAG_MSG_TYPE_PHOTO_COMMENT; + RsGxsPhotoCommentItem* commentItem = new RsGxsPhotoCommentItem(); + commentItem->comment = comment; + commentItem->meta = comment.mMeta; + commentItem->meta.mMsgFlags = FLAG_MSG_TYPE_PHOTO_COMMENT; - RsGenExchange::publishMsg(token, commentItem); - return true; + RsGenExchange::publishMsg(token, commentItem); + return true; } bool p3PhotoService::acknowledgeMsg(const uint32_t& token, @@ -429,12 +389,12 @@ bool p3PhotoService::acknowledgeGrp(const uint32_t& token, bool p3PhotoService::subscribeToAlbum(uint32_t &token, const RsGxsGroupId &grpId, bool subscribe) { - if(subscribe) - RsGenExchange::setGroupSubscribeFlags(token, grpId, GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED, GXS_SERV::GROUP_SUBSCRIBE_MASK); - else - RsGenExchange::setGroupSubscribeFlags(token, grpId, 0, GXS_SERV::GROUP_SUBSCRIBE_MASK); + if(subscribe) + RsGenExchange::setGroupSubscribeFlags(token, grpId, GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED, GXS_SERV::GROUP_SUBSCRIBE_MASK); + else + RsGenExchange::setGroupSubscribeFlags(token, grpId, 0, GXS_SERV::GROUP_SUBSCRIBE_MASK); - return true; + return true; } diff --git a/libretroshare/src/services/p3wiki.cc b/libretroshare/src/services/p3wiki.cc index 26c33881a..47bcb2ae0 100644 --- a/libretroshare/src/services/p3wiki.cc +++ b/libretroshare/src/services/p3wiki.cc @@ -40,7 +40,7 @@ RsWiki *rsWiki = NULL; p3Wiki::p3Wiki(RsGeneralDataService* gds, RsNetworkExchangeService* nes, RsGixs *gixs) :RsGenExchange(gds, nes, new RsGxsWikiSerialiser(), RS_SERVICE_GXS_TYPE_WIKI, gixs, wikiAuthenPolicy()), - RsWiki(this) + RsWiki(static_cast(*this)) { // Setup of dummy Pages. mAboutActive = false; diff --git a/libretroshare/src/services/p3wire.cc b/libretroshare/src/services/p3wire.cc index 23d31198f..530265bdc 100644 --- a/libretroshare/src/services/p3wire.cc +++ b/libretroshare/src/services/p3wire.cc @@ -33,7 +33,7 @@ RsWire *rsWire = NULL; p3Wire::p3Wire(RsGeneralDataService* gds, RsNetworkExchangeService* nes, RsGixs *gixs) :RsGenExchange(gds, nes, new RsGxsWireSerialiser(), RS_SERVICE_GXS_TYPE_WIRE, gixs, wireAuthenPolicy()), - RsWire(this), mWireMtx("WireMtx") + RsWire(static_cast(*this)), mWireMtx("WireMtx") { } diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index de9a88d02..6457d2831 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -104,6 +104,12 @@ #ifdef RS_USE_WIKI #include "gui/WikiPoos/WikiDialog.h" #endif +#ifdef RS_USE_WIRE +#include "gui/TheWire/WireDialog.h" +#endif +#ifdef RS_USE_PHOTO +#include "gui/PhotoShare/PhotoShare.h" +#endif #include "gui/Posted/PostedDialog.h" #include "gui/statistics/StatisticsWindow.h" @@ -426,6 +432,17 @@ void MainWindow::initStackedPage() addPage(wikiDialog = new WikiDialog(ui->stackPages), grp, ¬ify); #endif +#ifdef RS_USE_WIRE + WireDialog *wireDialog = NULL; + addPage(wireDialog = new WireDialog(ui->stackPages), grp, ¬ify); +#endif + +#ifdef RS_USE_PHOTO + PhotoShare *photoDialog = NULL; + addPage(photoDialog = new PhotoShare(ui->stackPages), grp, ¬ify); +#endif + + std::cerr << "Looking for interfaces in existing plugins:" << std::endl; for(int i = 0;inbPlugins();++i) { diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.cpp b/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.cpp index 5d5461d79..68c74e221 100644 --- a/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.cpp +++ b/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.cpp @@ -128,7 +128,7 @@ void AlbumCreateDialog::publishPhotos() } -bool AlbumCreateDialog::getAlbumThumbnail(RsPhotoThumbnail &nail) +bool AlbumCreateDialog::getAlbumThumbnail(RsGxsImage &image) { const QPixmap *tmppix = &mThumbNail; @@ -142,17 +142,11 @@ bool AlbumCreateDialog::getAlbumThumbnail(RsPhotoThumbnail &nail) buffer.open(QIODevice::WriteOnly); tmppix->save(&buffer, "PNG"); // writes image into ba in PNG format - RsPhotoThumbnail tmpnail; - tmpnail.data = (uint8_t *) ba.data(); - tmpnail.size = ba.size(); - - nail.copyFrom(tmpnail); - + image.copy((uint8_t *) ba.data(), ba.size()); return true; } - nail.data = NULL; - nail.size = 0; + image.clear(); return false; } diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.h b/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.h index 41b0896ba..d136a374b 100644 --- a/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.h +++ b/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.h @@ -55,7 +55,7 @@ private slots: private: - bool getAlbumThumbnail(RsPhotoThumbnail &nail); + bool getAlbumThumbnail(RsGxsImage &image); private: Ui::AlbumCreateDialog *ui; diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumDialog.cpp b/retroshare-gui/src/gui/PhotoShare/AlbumDialog.cpp index e943d21d7..c7f0991df 100644 --- a/retroshare-gui/src/gui/PhotoShare/AlbumDialog.cpp +++ b/retroshare-gui/src/gui/PhotoShare/AlbumDialog.cpp @@ -60,17 +60,17 @@ void AlbumDialog::setUp() ui->textEdit_description->setText(QString::fromStdString(mAlbum.mDescription)); - QPixmap qtn; - GxsIdDetails::loadPixmapFromData(mAlbum.mThumbnail.data, mAlbum.mThumbnail.size, mAlbum.mThumbnail.type.c_str(),qtn); - if(mAlbum.mThumbnail.size != 0) + if(mAlbum.mThumbnail.mSize != 0) { - ui->label_thumbNail->setPixmap(qtn); + QPixmap qtn; + GxsIdDetails::loadPixmapFromData(mAlbum.mThumbnail.mData, mAlbum.mThumbnail.mSize,qtn, GxsIdDetails::ORIGINAL); + ui->label_thumbNail->setPixmap(qtn); } else { - // display a default Album icon when album has no Thumbnail - ui->label_thumbNail->setPixmap(QPixmap(":/images/album_default_128.png")); + // display a default Album icon when album has no Thumbnail + ui->label_thumbNail->setPixmap(QPixmap(":/images/album_default_128.png")); } } diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumExtra.cpp b/retroshare-gui/src/gui/PhotoShare/AlbumExtra.cpp new file mode 100644 index 000000000..c6ddf6e17 --- /dev/null +++ b/retroshare-gui/src/gui/PhotoShare/AlbumExtra.cpp @@ -0,0 +1,41 @@ +/******************************************************************************* + * retroshare-gui/src/gui/PhotoShare/AlbumExtra.cpp * + * * + * Copyright (C) 2018 by Robert Fernie * + * * + * 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 "AlbumExtra.h" +#include "ui_AlbumExtra.h" + +AlbumExtra::AlbumExtra(QWidget *parent) : + QWidget(NULL), + ui(new Ui::AlbumExtra) +{ + ui->setupUi(this); + setUp(); +} + +AlbumExtra::~AlbumExtra() +{ + delete ui; +} + +void AlbumExtra::setUp() +{ + +} + diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumExtra.h b/retroshare-gui/src/gui/PhotoShare/AlbumExtra.h new file mode 100644 index 000000000..1a932bcaa --- /dev/null +++ b/retroshare-gui/src/gui/PhotoShare/AlbumExtra.h @@ -0,0 +1,44 @@ +/******************************************************************************* + * retroshare-gui/src/gui/PhotoShare/AlbumExtra.h * + * * + * Copyright (C) 2020 by Robert Fernie * + * * + * 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 ALBUMEXTRA_H +#define ALBUMEXTRA_H + +#include + +namespace Ui { + class AlbumExtra; +} + +class AlbumExtra : public QWidget +{ + Q_OBJECT + +public: + explicit AlbumExtra(QWidget *parent = 0); + virtual ~AlbumExtra(); + +private: + void setUp(); +private: + Ui::AlbumExtra *ui; +}; + +#endif // ALBUMEXTRA_H diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumExtra.ui b/retroshare-gui/src/gui/PhotoShare/AlbumExtra.ui new file mode 100644 index 000000000..09780a77a --- /dev/null +++ b/retroshare-gui/src/gui/PhotoShare/AlbumExtra.ui @@ -0,0 +1,162 @@ + + + AlbumExtra + + + + 0 + 0 + 513 + 198 + + + + + 0 + 0 + + + + Form + + + + + + Category: + + + + + + + + Animals + + + + + Family + + + + + Friends + + + + + Flowers + + + + + Holiday + + + + + Landscapes + + + + + Pets + + + + + Portraits + + + + + Travel + + + + + Work + + + + + Random + + + + + + + + Quality: + + + + + + + + 0 + 0 + + + + + Resize Images (< 1Mb) + + + + + Resize Images (< 10Mb) + + + + + Send Original Images + + + + + + + + Qt::Horizontal + + + + + + + Caption: + + + + + + + + + + Where: + + + + + + + + + + Photographer: + + + + + + + + + + + diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumGroupDialog.cpp b/retroshare-gui/src/gui/PhotoShare/AlbumGroupDialog.cpp new file mode 100644 index 000000000..33e6cc229 --- /dev/null +++ b/retroshare-gui/src/gui/PhotoShare/AlbumGroupDialog.cpp @@ -0,0 +1,186 @@ +/******************************************************************************* + * retroshare-gui/src/gui/PhotoShare/AlbumGroupDialog.cpp * + * * + * Copyright (C) 2020 by Robert Fernie * + * * + * 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 "AlbumGroupDialog.h" +#include "AlbumExtra.h" +#include "gui/gxs/GxsIdDetails.h" + +#include + +const uint32_t AlbumCreateEnabledFlags = ( + GXS_GROUP_FLAGS_NAME | + GXS_GROUP_FLAGS_ICON | + GXS_GROUP_FLAGS_DESCRIPTION | + GXS_GROUP_FLAGS_DISTRIBUTION | + // GXS_GROUP_FLAGS_PUBLISHSIGN | + // GXS_GROUP_FLAGS_SHAREKEYS | // disabled because the UI doesn't handle it yet. + // GXS_GROUP_FLAGS_PERSONALSIGN | + // GXS_GROUP_FLAGS_COMMENTS | + GXS_GROUP_FLAGS_EXTRA | + 0); + +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_REQUIRED | + //GXS_GROUP_DEFAULTS_PUBLISH_ENCRYPTED | + + //GXS_GROUP_DEFAULTS_PERSONAL_GPG | + GXS_GROUP_DEFAULTS_PERSONAL_REQUIRED | + //GXS_GROUP_DEFAULTS_PERSONAL_IFNOPUB | + + //GXS_GROUP_DEFAULTS_COMMENTS_YES | + GXS_GROUP_DEFAULTS_COMMENTS_NO | + 0); + +uint32_t AlbumEditEnabledFlags = AlbumCreateEnabledFlags; +uint32_t AlbumEditDefaultsFlags = AlbumCreateDefaultsFlags; + +AlbumGroupDialog::AlbumGroupDialog(TokenQueue *tokenQueue, QWidget *parent) + : GxsGroupDialog(tokenQueue, AlbumCreateEnabledFlags, AlbumCreateDefaultsFlags, parent) +{ +} + +AlbumGroupDialog::AlbumGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent) + : GxsGroupDialog(tokenExternalQueue, tokenService, mode, groupId, AlbumEditEnabledFlags, AlbumEditDefaultsFlags, parent) +{ +} + +void AlbumGroupDialog::initUi() +{ + switch (mode()) + { + case MODE_CREATE: + setUiText(UITYPE_SERVICE_HEADER, tr("Create New Album")); + setUiText(UITYPE_BUTTONBOX_OK, tr("Create")); + break; + case MODE_SHOW: + setUiText(UITYPE_SERVICE_HEADER, tr("Album")); + break; + case MODE_EDIT: + setUiText(UITYPE_SERVICE_HEADER, tr("Edit ALbum")); + setUiText(UITYPE_BUTTONBOX_OK, tr("Update Album")); + break; + } + + setUiText(UITYPE_ADD_ADMINS_CHECKBOX, tr("Add Album Admins")); + setUiText(UITYPE_CONTACTS_DOCK, tr("Select Album Admins")); + + // Inject Extra Widgets. + injectExtraWidget(new AlbumExtra(this)); +} + +QPixmap AlbumGroupDialog::serviceImage() +{ + return QPixmap(":/images/album_create_64.png"); +} + +void AlbumGroupDialog::prepareAlbumGroup(RsPhotoAlbum &group, const RsGroupMetaData &meta) +{ + group.mMeta = meta; + group.mDescription = getDescription().toUtf8().constData(); + + QPixmap pixmap = getLogo(); + + if (!pixmap.isNull()) { + QByteArray ba; + QBuffer buffer(&ba); + + buffer.open(QIODevice::WriteOnly); + pixmap.save(&buffer, "PNG"); // writes image into ba in PNG format + + group.mThumbnail.copy((uint8_t *) ba.data(), ba.size()); + } else { + group.mThumbnail.clear(); + } + + // Additional Fields that we need to fill in. + group.mCaption = "Caption goes here"; + group.mPhotographer = "photographer"; + group.mWhere = "Where?"; + +} + +bool AlbumGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta) +{ + // Specific Function. + RsPhotoAlbum grp; + prepareAlbumGroup(grp, meta); + + rsPhoto->submitAlbumDetails(token, grp); + return true; +} + +bool AlbumGroupDialog::service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta) +{ + RsPhotoAlbum grp; + prepareAlbumGroup(grp, editedMeta); + + std::cerr << "AlbumGroupDialog::service_EditGroup() submitting changes"; + std::cerr << std::endl; + + // TODO: no interface here, yet. + // rsPhoto->updateGroup(token, grp); + return true; +} + +bool AlbumGroupDialog::service_loadGroup(uint32_t token, Mode /*mode*/, RsGroupMetaData& groupMetaData, QString &description) +{ + std::cerr << "AlbumGroupDialog::service_loadGroup(" << token << ")"; + std::cerr << std::endl; + + std::vector groups; + if (!rsPhoto->getAlbum(token, groups)) + { + std::cerr << "AlbumGroupDialog::service_loadGroup() Error getting GroupData"; + std::cerr << std::endl; + return false; + } + + if (groups.size() != 1) + { + std::cerr << "AlbumGroupDialog::service_loadGroup() Error Group.size() != 1"; + std::cerr << std::endl; + return false; + } + + std::cerr << "AlbumGroupDialog::service_loadGroup() Unfinished Loading"; + std::cerr << std::endl; + + const RsPhotoAlbum &group = groups[0]; + groupMetaData = group.mMeta; + description = QString::fromUtf8(group.mDescription.c_str()); + + if (group.mThumbnail.mData) { + QPixmap pixmap; + if (GxsIdDetails::loadPixmapFromData(group.mThumbnail.mData, group.mThumbnail.mSize, pixmap,GxsIdDetails::ORIGINAL)) { + setLogo(pixmap); + } + } else { + setLogo(QPixmap(":/images/album_create_64.png")); + } + + // NEED TO Load additional data.... + return true; +} diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumGroupDialog.h b/retroshare-gui/src/gui/PhotoShare/AlbumGroupDialog.h new file mode 100644 index 000000000..a06ce3461 --- /dev/null +++ b/retroshare-gui/src/gui/PhotoShare/AlbumGroupDialog.h @@ -0,0 +1,47 @@ +/******************************************************************************* + * retroshare-gui/src/gui/Posted/PostedGroupDialog.h * + * * + * Copyright (C) 2020 by Robert Fernie * + * * + * 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 _ALBUM_GROUP_DIALOG_H +#define _ALBUM_GROUP_DIALOG_H + +#include "gui/gxs/GxsGroupDialog.h" +#include + +class AlbumGroupDialog : public GxsGroupDialog +{ + Q_OBJECT + +public: + AlbumGroupDialog(TokenQueue *tokenQueue, QWidget *parent); + AlbumGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent); + +protected: + virtual void initUi(); + virtual QPixmap serviceImage(); + virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta); + virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData, QString &description); + virtual bool service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta); + +private: + void prepareAlbumGroup(RsPhotoAlbum &group, const RsGroupMetaData &meta); +}; + +#endif diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumItem.cpp b/retroshare-gui/src/gui/PhotoShare/AlbumItem.cpp index 4637a673a..1eb79dd98 100644 --- a/retroshare-gui/src/gui/PhotoShare/AlbumItem.cpp +++ b/retroshare-gui/src/gui/PhotoShare/AlbumItem.cpp @@ -41,17 +41,17 @@ void AlbumItem::setUp() { ui->label_AlbumTitle->setText(QString::fromStdString(mAlbum.mMeta.mGroupName)); ui->label_Photographer->setText(QString::fromStdString(mAlbum.mPhotographer)); - QPixmap qtn; - qtn.loadFromData(mAlbum.mThumbnail.data, mAlbum.mThumbnail.size, mAlbum.mThumbnail.type.c_str()); - if(mAlbum.mThumbnail.size != 0) + if(mAlbum.mThumbnail.mSize != 0) { - ui->label_Thumbnail->setPixmap(qtn); + QPixmap qtn; + qtn.loadFromData(mAlbum.mThumbnail.mData, mAlbum.mThumbnail.mSize, "PNG"); + ui->label_Thumbnail->setPixmap(qtn); } else { - // display a default Album icon when album has no Thumbnail - ui->label_Thumbnail->setPixmap(QPixmap(":/images/album_default_128.png")); + // display a default Album icon when album has no Thumbnail + ui->label_Thumbnail->setPixmap(QPixmap(":/images/album_default_128.png")); } } diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoDialog.cpp b/retroshare-gui/src/gui/PhotoShare/PhotoDialog.cpp index a3e0e8c69..0d2112304 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoDialog.cpp +++ b/retroshare-gui/src/gui/PhotoShare/PhotoDialog.cpp @@ -53,7 +53,7 @@ PhotoDialog::~PhotoDialog() void PhotoDialog::setUp() { QPixmap qtn; - qtn.loadFromData(mPhotoDetails.mThumbnail.data, mPhotoDetails.mThumbnail.size, mPhotoDetails.mThumbnail.type.c_str()); + qtn.loadFromData(mPhotoDetails.mThumbnail.mData, mPhotoDetails.mThumbnail.mSize, "PNG"); ui->label_Photo->setPixmap(qtn); ui->lineEdit_Title->setText(QString::fromStdString(mPhotoDetails.mMeta.mMsgName)); diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoItem.cpp b/retroshare-gui/src/gui/PhotoShare/PhotoItem.cpp index f0cfaa895..56378467f 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoItem.cpp +++ b/retroshare-gui/src/gui/PhotoShare/PhotoItem.cpp @@ -60,7 +60,7 @@ PhotoItem::PhotoItem(PhotoShareItemHolder *holder, const QString& path, QWidget ui->label_Thumbnail->setPixmap(mThumbNail.scaled(120, 120, Qt::KeepAspectRatio, Qt::SmoothTransformation)); setSelected(false); - getPhotoThumbnail(mPhotoDetails.mThumbnail); + getThumbnail(mPhotoDetails.mThumbnail); connect(ui->lineEdit_Title, SIGNAL(editingFinished()), this, SLOT(setTitle())); connect(ui->lineEdit_PhotoGrapher, SIGNAL(editingFinished()), this, SLOT(setPhotoGrapher())); @@ -83,7 +83,7 @@ void PhotoItem::setSelected(bool selected) update(); } -bool PhotoItem::getPhotoThumbnail(RsPhotoThumbnail &nail) +bool PhotoItem::getThumbnail(RsGxsImage &image) { const QPixmap *tmppix = &mThumbNail; @@ -96,18 +96,11 @@ bool PhotoItem::getPhotoThumbnail(RsPhotoThumbnail &nail) buffer.open(QIODevice::WriteOnly); tmppix->save(&buffer, "PNG"); // writes image into ba in PNG format - - RsPhotoThumbnail tmpnail; - tmpnail.data = (uint8_t *) ba.data(); - tmpnail.size = ba.size(); - - nail.copyFrom(tmpnail); - + image.copy((uint8_t *) ba.data(), ba.size()); return true; } - nail.data = NULL; - nail.size = 0; + image.clear(); return false; } @@ -166,12 +159,12 @@ void PhotoItem::setUp() updateImage(mPhotoDetails.mThumbnail); } -void PhotoItem::updateImage(const RsPhotoThumbnail &thumbnail) +void PhotoItem::updateImage(const RsGxsImage &image) { - if (thumbnail.data != NULL) + if (image.mData != NULL) { QPixmap qtn; - qtn.loadFromData(thumbnail.data, thumbnail.size, thumbnail.type.c_str()); + qtn.loadFromData(image.mData, image.mSize, "PNG"); ui->label_Thumbnail->setPixmap(qtn.scaled(120, 120, Qt::KeepAspectRatio, Qt::SmoothTransformation)); mThumbNail = qtn; } diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoItem.h b/retroshare-gui/src/gui/PhotoShare/PhotoItem.h index ee7b4e578..8b5ca5a18 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoItem.h +++ b/retroshare-gui/src/gui/PhotoShare/PhotoItem.h @@ -42,13 +42,13 @@ public: void setSelected(bool selected); bool isSelected(){ return mSelected; } const RsPhotoPhoto& getPhotoDetails(); - bool getPhotoThumbnail(RsPhotoThumbnail &nail); + bool getThumbnail(RsGxsImage &image); protected: void mousePressEvent(QMouseEvent *event); private: - void updateImage(const RsPhotoThumbnail &thumbnail); + void updateImage(const RsGxsImage &image); void setUp(); private slots: diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoShare.cpp b/retroshare-gui/src/gui/PhotoShare/PhotoShare.cpp index 5c00bcb7a..6b86e8a71 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoShare.cpp +++ b/retroshare-gui/src/gui/PhotoShare/PhotoShare.cpp @@ -31,7 +31,7 @@ #include #include -#include "AlbumCreateDialog.h" +#include "AlbumGroupDialog.h" #include "AlbumItem.h" #include "PhotoItem.h" @@ -76,7 +76,7 @@ PhotoShare::PhotoShare(QWidget *parent) connect( ui.toolButton_ViewAlbum, SIGNAL(clicked()), this, SLOT(OpenAlbumDialog())); connect( ui.toolButton_SlideShow, SIGNAL(clicked()), this, SLOT(OpenSlideShow())); connect( ui.toolButton_subscribe, SIGNAL(clicked()), this, SLOT(subscribeToAlbum())); - connect(ui.toolButton_ViewPhoto, SIGNAL(clicked()), this, SLOT(OpenPhotoDialog())); + connect( ui.toolButton_ViewPhoto, SIGNAL(clicked()), this, SLOT(OpenPhotoDialog())); connect( ui.pushButton_YourAlbums, SIGNAL(clicked()), this, SLOT(updateAlbums())); connect( ui.pushButton_SharedAlbums, SIGNAL(clicked()), this, SLOT(updateAlbums())); @@ -215,7 +215,7 @@ void PhotoShare::OpenSlideShow() void PhotoShare::createAlbum() { - AlbumCreateDialog albumCreate(mPhotoQueue, rsPhoto, this); + AlbumGroupDialog albumCreate(mPhotoQueue, this); albumCreate.exec(); } diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoShare.h b/retroshare-gui/src/gui/PhotoShare/PhotoShare.h index 9bebcd1c5..2462fea44 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoShare.h +++ b/retroshare-gui/src/gui/PhotoShare/PhotoShare.h @@ -28,7 +28,6 @@ #include "retroshare/rsphoto.h" #include "retroshare-gui/mainpage.h" -#include "AlbumCreateDialog.h" #include "AlbumDialog.h" #include "PhotoDialog.h" @@ -39,6 +38,8 @@ #include "util/TokenQueue.h" #include "PhotoShareItemHolder.h" +#define IMAGE_PHOTO ":/icons/png/photo.png" + namespace Ui { class PhotoShare; } @@ -51,6 +52,10 @@ public: PhotoShare(QWidget *parent = 0); ~PhotoShare(); + virtual QIcon iconPixmap() const { return QIcon(IMAGE_PHOTO) ; } + virtual QString pageName() const { return tr("Photo Albums") ; } + virtual QString helpText() const { return ""; } + void notifySelection(PhotoShareItem* selection); private slots: diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoSlideShow.cpp b/retroshare-gui/src/gui/PhotoShare/PhotoSlideShow.cpp index 8b1df126f..7e5fb6d00 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoSlideShow.cpp +++ b/retroshare-gui/src/gui/PhotoShare/PhotoSlideShow.cpp @@ -20,6 +20,7 @@ #include "gui/PhotoShare/PhotoSlideShow.h" #include "gui/PhotoShare/PhotoDrop.h" +#include "gui/gxs/GxsIdDetails.h" #include @@ -175,16 +176,10 @@ void PhotoSlideShow::loadImage() if (ptr) { /* load into the slot */ - if (ptr->mThumbnail.data != NULL) + if (ptr->mThumbnail.mData != NULL) { QPixmap qtn; - - // copy the data for Qpixmap to use. - RsPhotoThumbnail tn; - tn.copyFrom(ptr->mThumbnail); - qtn.loadFromData(tn.data, tn.size, tn.type.c_str()); - tn.data = 0; - + GxsIdDetails::loadPixmapFromData(ptr->mThumbnail.mData, ptr->mThumbnail.mSize,qtn, GxsIdDetails::ORIGINAL); QPixmap sqtn = qtn.scaled(800, 600, Qt::KeepAspectRatio, Qt::SmoothTransformation); ui.imgLabel->setPixmap(sqtn); @@ -249,8 +244,8 @@ bool PhotoSlideShow::loadPhotoData(const uint32_t &token) RsPhotoPhoto& photo = *vit; RsPhotoPhoto *ptr = new RsPhotoPhoto; *ptr = photo; - ptr->mThumbnail.data = 0; - ptr->mThumbnail.copyFrom(photo.mThumbnail); + + ptr->mThumbnail = photo.mThumbnail; // copies data. ptr->mOrder = i++; mPhotos[photo.mMeta.mMsgId] = ptr; mPhotoOrder[ptr->mOrder] = photo.mMeta.mMsgId; diff --git a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.cpp b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.cpp index ddacd4895..71094b91b 100644 --- a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.cpp +++ b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.cpp @@ -22,6 +22,8 @@ #include #include #include +#include + #include "PostedCreatePostDialog.h" #include "ui_PostedCreatePostDialog.h" @@ -35,10 +37,13 @@ #include #include - +#include #include -#include +/* View Page */ +#define VIEW_POST 1 +#define VIEW_IMAGE 2 +#define VIEW_LINK 3 PostedCreatePostDialog::PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted *posted, const RsGxsGroupId& grpId, QWidget *parent): QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint), @@ -67,6 +72,16 @@ PostedCreatePostDialog::PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted *pos /* fill in the available OwnIds for signing */ ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId()); + QSignalMapper *signalMapper = new QSignalMapper(this); + connect(ui->postButton, SIGNAL(clicked()), signalMapper, SLOT(map())); + connect(ui->imageButton, SIGNAL(clicked()), signalMapper, SLOT(map())); + connect(ui->linkButton, SIGNAL(clicked()), signalMapper, SLOT(map())); + + signalMapper->setMapping(ui->postButton, VIEW_POST); + signalMapper->setMapping(ui->imageButton, VIEW_IMAGE); + signalMapper->setMapping(ui->linkButton, VIEW_LINK); + connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(setPage(int))); + ui->removeButton->hide(); /* load settings */ @@ -93,11 +108,17 @@ void PostedCreatePostDialog::processSettings(bool load) // state of ID Chooser combobox int index = Settings->value("IDChooser", 0).toInt(); ui->idChooser->setCurrentIndex(index); + + // load last used Stacked Page + setPage(Settings->value("viewPage", VIEW_POST).toInt()); } else { // save settings // state of ID Chooser combobox Settings->setValue("IDChooser", ui->idChooser->currentIndex()); + + // store last used Page + Settings->setValue("viewPage", viewMode()); } Settings->endGroup(); @@ -222,19 +243,51 @@ void PostedCreatePostDialog::addPicture() } -void PostedCreatePostDialog::on_postButton_clicked() +int PostedCreatePostDialog::viewMode() { - ui->stackedWidget->setCurrentIndex(0); + if (ui->postButton->isChecked()) { + return VIEW_POST; + } else if (ui->imageButton->isChecked()) { + return VIEW_IMAGE; + } else if (ui->linkButton->isChecked()) { + return VIEW_LINK; + } + + /* Default */ + return VIEW_POST; } -void PostedCreatePostDialog::on_imageButton_clicked() +void PostedCreatePostDialog::setPage(int viewMode) { - ui->stackedWidget->setCurrentIndex(1); -} + switch (viewMode) { + case VIEW_POST: + ui->stackedWidget->setCurrentIndex(0); -void PostedCreatePostDialog::on_linkButton_clicked() -{ - ui->stackedWidget->setCurrentIndex(2); + ui->postButton->setChecked(true); + ui->imageButton->setChecked(false); + ui->linkButton->setChecked(false); + + break; + case VIEW_IMAGE: + ui->stackedWidget->setCurrentIndex(1); + + ui->imageButton->setChecked(true); + ui->postButton->setChecked(false); + ui->linkButton->setChecked(false); + + break; + case VIEW_LINK: + ui->stackedWidget->setCurrentIndex(2); + + ui->linkButton->setChecked(true); + ui->postButton->setChecked(false); + ui->imageButton->setChecked(false); + + break; + default: + setPage(VIEW_POST); + return; + } } void PostedCreatePostDialog::on_removeButton_clicked() diff --git a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.h b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.h index 5aed59950..6e11c795b 100644 --- a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.h +++ b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.h @@ -52,14 +52,13 @@ private: private slots: void createPost(); void addPicture(); - void on_postButton_clicked(); - void on_imageButton_clicked(); - void on_linkButton_clicked(); void on_removeButton_clicked(); void fileHashingFinished(QList hashedFiles); + void setPage(int viewMode); private: void processSettings(bool load); + int viewMode(); QString mLink; QString mNotes; diff --git a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.ui b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.ui index 50abd48a2..1cdea5f8a 100644 --- a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.ui +++ b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.ui @@ -246,36 +246,7 @@ 2 - - - - - 800 - 200 - - - - - - - true - - - - - - - Qt::Horizontal - - - - 188 - 17 - - - - - + Remove image @@ -295,6 +266,42 @@ + + + + Qt::Horizontal + + + + 188 + 17 + + + + + + + + Share Orginal Image + + + + + + + + 800 + 200 + + + + + + + true + + + @@ -418,6 +425,9 @@ 24 + + true + @@ -435,6 +445,15 @@ 24 + + true + + + false + + + false + @@ -452,6 +471,12 @@ 24 + + true + + + true + diff --git a/retroshare-gui/src/gui/Posted/PostedDialog.cpp b/retroshare-gui/src/gui/Posted/PostedDialog.cpp index e696db36c..6faf20574 100644 --- a/retroshare-gui/src/gui/Posted/PostedDialog.cpp +++ b/retroshare-gui/src/gui/Posted/PostedDialog.cpp @@ -93,13 +93,13 @@ UserNotify *PostedDialog::createUserNotify(QObject *parent) QString PostedDialog::getHelpString() const { - QString hlp_str = tr("

  Posted

\ -

The posted service allows you to share internet links, that spread among Retroshare nodes like forums and \ + QString hlp_str = tr("

  Boards

\ +

The Boards service allows you to share images, blog posts & internet links, that spread among Retroshare nodes like forums and \ channels

\ -

Links can be commented by subscribed users. A promotion system also gives the opportunity to \ +

Posts can be commented by subscribed users. A promotion system also gives the opportunity to \ enlight important links.

\

There is no restriction on which links are shared. Be careful when clicking on them.

\ -

Posted links are kept for %1 days, and sync-ed over the last %2 days, unless you change this.

\ +

Boards are kept for %1 days, and sync-ed over the last %2 days, unless you change this.

\ ").arg(QString::number(rsPosted->getDefaultStoragePeriod()/86400)).arg(QString::number(rsPosted->getDefaultSyncPeriod()/86400)); return hlp_str ; @@ -109,9 +109,9 @@ QString PostedDialog::text(TextType type) { switch (type) { case TEXT_NAME: - return tr("Posted Links"); + return tr("Boards"); case TEXT_NEW: - return tr("Create Topic"); + return tr("Create Board"); case TEXT_TODO: return "Open points:
    " "
  • Subreddits/tag to posts support" @@ -120,13 +120,13 @@ QString PostedDialog::text(TextType type) "
"; case TEXT_YOUR_GROUP: - return tr("My Topics"); + return tr("My Boards"); case TEXT_SUBSCRIBED_GROUP: - return tr("Subscribed Topics"); + return tr("Subscribed Boards"); case TEXT_POPULAR_GROUP: - return tr("Popular Topics"); + return tr("Popular Boards"); case TEXT_OTHER_GROUP: - return tr("Other Topics"); + return tr("Other Boards"); } return ""; diff --git a/retroshare-gui/src/gui/Posted/PostedDialog.h b/retroshare-gui/src/gui/Posted/PostedDialog.h index 7f23ee24f..6a4d79479 100644 --- a/retroshare-gui/src/gui/Posted/PostedDialog.h +++ b/retroshare-gui/src/gui/Posted/PostedDialog.h @@ -37,7 +37,7 @@ public: ~PostedDialog(); virtual QIcon iconPixmap() const { return QIcon(IMAGE_POSTED) ; } //MainPage - virtual QString pageName() const { return tr("Links") ; } //MainPage + virtual QString pageName() const { return tr("Boards") ; } //MainPage virtual QString helpText() const { return ""; } //MainPage protected: diff --git a/retroshare-gui/src/gui/Posted/PostedGroupDialog.cpp b/retroshare-gui/src/gui/Posted/PostedGroupDialog.cpp index 678c41a98..a2627d167 100644 --- a/retroshare-gui/src/gui/Posted/PostedGroupDialog.cpp +++ b/retroshare-gui/src/gui/Posted/PostedGroupDialog.cpp @@ -71,20 +71,20 @@ void PostedGroupDialog::initUi() switch (mode()) { case MODE_CREATE: - setUiText(UITYPE_SERVICE_HEADER, tr("Create New Topic")); + setUiText(UITYPE_SERVICE_HEADER, tr("Create New Board")); setUiText(UITYPE_BUTTONBOX_OK, tr("Create")); break; case MODE_SHOW: - setUiText(UITYPE_SERVICE_HEADER, tr("Posted Topic")); + setUiText(UITYPE_SERVICE_HEADER, tr("Board")); break; case MODE_EDIT: - setUiText(UITYPE_SERVICE_HEADER, tr("Edit Topic")); - setUiText(UITYPE_BUTTONBOX_OK, tr("Update Topic")); + setUiText(UITYPE_SERVICE_HEADER, tr("Edit Board")); + setUiText(UITYPE_BUTTONBOX_OK, tr("Update Board")); break; } - setUiText(UITYPE_ADD_ADMINS_CHECKBOX, tr("Add Topic Admins")); - setUiText(UITYPE_CONTACTS_DOCK, tr("Select Topic Admins")); + setUiText(UITYPE_ADD_ADMINS_CHECKBOX, tr("Add Board Admins")); + setUiText(UITYPE_CONTACTS_DOCK, tr("Select Board Admins")); } QPixmap PostedGroupDialog::serviceImage() diff --git a/retroshare-gui/src/gui/Posted/PostedListWidget.cpp b/retroshare-gui/src/gui/Posted/PostedListWidget.cpp index 0d7960804..834fe3e64 100644 --- a/retroshare-gui/src/gui/Posted/PostedListWidget.cpp +++ b/retroshare-gui/src/gui/Posted/PostedListWidget.cpp @@ -43,7 +43,7 @@ #define DEBUG_POSTED_LIST_WIDGET -#define TOPIC_DEFAULT_IMAGE ":/icons/png/posted.png" +#define BOARD_DEFAULT_IMAGE ":/icons/png/posted.png" /* View mode */ #define VIEW_MODE_CLASSIC 1 @@ -351,13 +351,13 @@ void PostedListWidget::insertPostedDetails(const RsPostedGroup &group) ui->subscribeToolButton->setHidden(IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags)) ; /* IMAGE */ - QPixmap topicImage; + QPixmap boardImage; if (group.mGroupImage.mData != NULL) { - GxsIdDetails::loadPixmapFromData(group.mGroupImage.mData, group.mGroupImage.mSize, topicImage,GxsIdDetails::ORIGINAL); + GxsIdDetails::loadPixmapFromData(group.mGroupImage.mData, group.mGroupImage.mSize, boardImage,GxsIdDetails::ORIGINAL); } else { - topicImage = QPixmap(TOPIC_DEFAULT_IMAGE); + boardImage = QPixmap(BOARD_DEFAULT_IMAGE); } - ui->logoLabel->setPixmap(topicImage); + ui->logoLabel->setPixmap(boardImage); ui->namelabel->setText(QString::fromUtf8(group.mMeta.mGroupName.c_str())); ui->poplabel->setText(QString::number( group.mMeta.mPop)); diff --git a/retroshare-gui/src/gui/Posted/PostedListWidget.ui b/retroshare-gui/src/gui/Posted/PostedListWidget.ui index 304a79c76..8261a5c65 100644 --- a/retroshare-gui/src/gui/Posted/PostedListWidget.ui +++ b/retroshare-gui/src/gui/Posted/PostedListWidget.ui @@ -89,7 +89,7 @@ - :/images/posted_24.png:/images/posted_24.png + :/images/write.png:/images/write.png @@ -285,7 +285,7 @@ - Topic Details + Board Details false @@ -557,7 +557,7 @@ p, li { white-space: pre-wrap; } 0 0 - 614 + 98 16 diff --git a/retroshare-gui/src/gui/Posted/Posted_images.qrc b/retroshare-gui/src/gui/Posted/Posted_images.qrc index 9c2be0db4..0710a04e6 100644 --- a/retroshare-gui/src/gui/Posted/Posted_images.qrc +++ b/retroshare-gui/src/gui/Posted/Posted_images.qrc @@ -1,16 +1,5 @@ - images/posted_16.png - images/posted_24.png - images/posted_32.png - images/posted_48.png - images/posted_64.png - images/posted_add_24.png - images/posted_add_32.png - images/posted_add_64.png - images/hot_24.png - images/new_24.png - images/posted_32_new.png images/expand.png images/decrease.png images/down-arrow.png @@ -29,5 +18,6 @@ images/down-hover.png images/up-hover.png images/trashcan.png + images/write.png diff --git a/retroshare-gui/src/gui/Posted/images/hot_128.png b/retroshare-gui/src/gui/Posted/images/hot_128.png deleted file mode 100644 index 652e2b5d4..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/hot_128.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/hot_24.png b/retroshare-gui/src/gui/Posted/images/hot_24.png deleted file mode 100644 index cf939b9b3..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/hot_24.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/hot_256.png b/retroshare-gui/src/gui/Posted/images/hot_256.png deleted file mode 100644 index 018b87708..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/hot_256.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/hot_32.png b/retroshare-gui/src/gui/Posted/images/hot_32.png deleted file mode 100644 index 59e9c3702..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/hot_32.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/hot_48.png b/retroshare-gui/src/gui/Posted/images/hot_48.png deleted file mode 100644 index 164570180..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/hot_48.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/hot_64.png b/retroshare-gui/src/gui/Posted/images/hot_64.png deleted file mode 100644 index 9f9ccc31e..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/hot_64.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/new_128.png b/retroshare-gui/src/gui/Posted/images/new_128.png deleted file mode 100644 index 86827c30b..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/new_128.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/new_24.png b/retroshare-gui/src/gui/Posted/images/new_24.png deleted file mode 100644 index 93cafc107..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/new_24.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/new_32.png b/retroshare-gui/src/gui/Posted/images/new_32.png deleted file mode 100644 index d932b6957..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/new_32.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/new_48.png b/retroshare-gui/src/gui/Posted/images/new_48.png deleted file mode 100644 index fad00e9de..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/new_48.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/new_64.png b/retroshare-gui/src/gui/Posted/images/new_64.png deleted file mode 100644 index 2325bf8fa..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/new_64.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/posted_128.png b/retroshare-gui/src/gui/Posted/images/posted_128.png deleted file mode 100644 index 178143057..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/posted_128.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/posted_16.png b/retroshare-gui/src/gui/Posted/images/posted_16.png deleted file mode 100644 index 6c07665a4..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/posted_16.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/posted_24.png b/retroshare-gui/src/gui/Posted/images/posted_24.png deleted file mode 100644 index 8de05ae32..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/posted_24.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/posted_256.png b/retroshare-gui/src/gui/Posted/images/posted_256.png deleted file mode 100644 index 901f51100..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/posted_256.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/posted_32.png b/retroshare-gui/src/gui/Posted/images/posted_32.png deleted file mode 100644 index 36ef018c3..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/posted_32.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/posted_32_new.png b/retroshare-gui/src/gui/Posted/images/posted_32_new.png deleted file mode 100644 index 773e5dd27..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/posted_32_new.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/posted_48.png b/retroshare-gui/src/gui/Posted/images/posted_48.png deleted file mode 100644 index b71b1cff3..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/posted_48.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/posted_64.png b/retroshare-gui/src/gui/Posted/images/posted_64.png deleted file mode 100644 index fbfaf5e58..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/posted_64.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/posted_add_128.png b/retroshare-gui/src/gui/Posted/images/posted_add_128.png deleted file mode 100644 index 40da463d1..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/posted_add_128.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/posted_add_24.png b/retroshare-gui/src/gui/Posted/images/posted_add_24.png deleted file mode 100644 index 87ecdde14..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/posted_add_24.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/posted_add_256.png b/retroshare-gui/src/gui/Posted/images/posted_add_256.png deleted file mode 100644 index e6ab57407..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/posted_add_256.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/posted_add_32.png b/retroshare-gui/src/gui/Posted/images/posted_add_32.png deleted file mode 100644 index 996452344..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/posted_add_32.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/posted_add_48.png b/retroshare-gui/src/gui/Posted/images/posted_add_48.png deleted file mode 100644 index 0c2418a53..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/posted_add_48.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/posted_add_64.png b/retroshare-gui/src/gui/Posted/images/posted_add_64.png deleted file mode 100644 index d87421a52..000000000 Binary files a/retroshare-gui/src/gui/Posted/images/posted_add_64.png and /dev/null differ diff --git a/retroshare-gui/src/gui/Posted/images/write.png b/retroshare-gui/src/gui/Posted/images/write.png new file mode 100644 index 000000000..f5702bfbd Binary files /dev/null and b/retroshare-gui/src/gui/Posted/images/write.png differ diff --git a/retroshare-gui/src/gui/TheWire/PulseItem.cpp b/retroshare-gui/src/gui/TheWire/PulseItem.cpp index 2eb328b3e..16b01d3a4 100644 --- a/retroshare-gui/src/gui/TheWire/PulseItem.cpp +++ b/retroshare-gui/src/gui/TheWire/PulseItem.cpp @@ -25,8 +25,6 @@ #include "PulseItem.h" -#include - #include #include @@ -35,217 +33,48 @@ ****/ /** Constructor */ -PulseItem::PulseItem(PulseHolder *parent, const RsPhotoAlbum &album, const RsPhotoThumbnail &thumbnail) -:QWidget(NULL), mParent(parent), mType(PHOTO_ITEM_TYPE_ALBUM) + +PulseItem::PulseItem(PulseHolder *parent, std::string path) +:QWidget(NULL), mParent(parent), mType(0) { - setupUi(this); + setupUi(this); + setAttribute ( Qt::WA_DeleteOnClose, true ); - setAttribute ( Qt::WA_DeleteOnClose, true ); - - mDetails = *( (RsPhotoPhoto *) &(album)); - updateAlbumText(album); - updateImage(thumbnail); - - setSelected(false); } - -PulseItem::PulseItem(PulseHolder *parent, const RsPhotoPhoto &photo, const RsPhotoThumbnail &thumbnail) -:QWidget(NULL), mParent(parent), mType(PHOTO_ITEM_TYPE_PHOTO) -{ - setupUi(this); - - setAttribute ( Qt::WA_DeleteOnClose, true ); - - mDetails = *( (RsPhotoPhoto *) &(photo)); - - updatePhotoText(photo); - updateImage(thumbnail); - - setSelected(false); -} - - -PulseItem::PulseItem(PulseHolder *parent, std::string path) // for new photos. -:QWidget(NULL), mParent(parent), mType(PHOTO_ITEM_TYPE_NEW) -{ - setupUi(this); - - setAttribute ( Qt::WA_DeleteOnClose, true ); - -#if 0 - QString dummyString("dummytext"); - titleLabel->setText(QString("NEW PHOTO")); - - fromBoldLabel->setText(QString("From:")); - fromLabel->setText(QString("Ourselves")); - - statusBoldLabel->setText(QString("Status:")); - statusLabel->setText(QString("new photo")); - - dateBoldLabel->setText(QString("Date:")); - dateLabel->setText(QString("now")); - - int width = 120; - int height = 120; - - //QPixmap qtn = QPixmap(QString::fromStdString(path)).scaled(width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); - QPixmap qtn = QPixmap(QString::fromStdString(path)).scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation); - imgLabel->setPixmap(qtn); - setSelected(false); -#endif -} - -void PulseItem::updateAlbumText(const RsPhotoAlbum &album) -{ -#if 0 - QString dummyString("dummytext"); - titleLabel->setText(QString("TITLE")); - - fromBoldLabel->setText(QString("From:")); - fromLabel->setText(QString("Unknown")); - - statusBoldLabel->setText(QString("Status:")); - statusLabel->setText(QString("new photo")); - - dateBoldLabel->setText(QString("Date:")); - dateLabel->setText(QString("now")); - - //QDateTime qtime; - //qtime.setTime_t(msg.ts); - //QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm"); - //timestamplabel->setText(timestamp); - - dateBoldLabel->setText(dummyString); - dateLabel->setText(dummyString); -#endif -} - -void PulseItem::updatePhotoText(const RsPhotoPhoto &photo) -{ -#if 0 - QString dummyString("dummytext"); - titleLabel->setText(QString("TITLE")); - - fromBoldLabel->setText(QString("From:")); - fromLabel->setText(QString("Unknown")); - - statusBoldLabel->setText(QString("Status:")); - statusLabel->setText(QString("new photo")); - - dateBoldLabel->setText(QString("Date:")); - dateLabel->setText(QString("now")); -#endif -} - - -void PulseItem::updateImage(const RsPhotoThumbnail &thumbnail) -{ -#if 0 - if (thumbnail.data != NULL) - { - QPixmap qtn; - qtn.loadFromData(thumbnail.data, thumbnail.size, thumbnail.type.c_str()); - imgLabel->setPixmap(qtn); - } -#endif -} - -bool PulseItem::getPhotoThumbnail(RsPhotoThumbnail &nail) -{ -#if 0 - const QPixmap *tmppix = imgLabel->pixmap(); - - 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 - - RsPhotoThumbnail tmpnail; - tmpnail.data = (uint8_t *) ba.data(); - tmpnail.size = ba.size(); - - nail.copyFrom(tmpnail); - - return true; - } - - nail.data = NULL; - nail.size = 0; -#endif - return false; -} - - void PulseItem::removeItem() { -#if 0 -#ifdef DEBUG_ITEM - std::cerr << "PulseItem::removeItem()"; - std::cerr << std::endl; -#endif - hide(); - if (mParent) - { - mParent->deletePulseItem(this, mType); - } -#endif } - void PulseItem::setSelected(bool on) { -#if 0 - mSelected = on; - if (mSelected) - { - mParent->notifySelection(this, mType); - frame->setStyleSheet("QFrame#frame{border: 2px solid #55CC55;\nbackground: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #55EE55, stop: 1 #CCCCCC);\nborder-radius: 10px}"); - } - else - { - frame->setStyleSheet("QFrame#frame{border: 2px solid #CCCCCC;\nbackground: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #EEEEEE, stop: 1 #CCCCCC);\nborder-radius: 10px}"); - } - update(); -#endif } bool PulseItem::isSelected() { - return mSelected; + return mSelected; } - void PulseItem::mousePressEvent(QMouseEvent *event) { - /* We can be very cunning here? - * grab out position. - * flag ourselves as selected. - * then pass the mousePressEvent up for handling by the parent - */ + /* We can be very cunning here? + * grab out position. + * flag ourselves as selected. + * then pass the mousePressEvent up for handling by the parent + */ - QPoint pos = event->pos(); + QPoint pos = event->pos(); - std::cerr << "PulseItem::mousePressEvent(" << pos.x() << ", " << pos.y() << ")"; - std::cerr << std::endl; + std::cerr << "PulseItem::mousePressEvent(" << pos.x() << ", " << pos.y() << ")"; + std::cerr << std::endl; - setSelected(true); + setSelected(true); - QWidget::mousePressEvent(event); + QWidget::mousePressEvent(event); } - const QPixmap *PulseItem::getPixmap() { -#if 0 - return imgLabel->pixmap(); -#endif - return NULL; + return NULL; } - diff --git a/retroshare-gui/src/gui/TheWire/PulseItem.h b/retroshare-gui/src/gui/TheWire/PulseItem.h index bfbdc710c..6bfeb3506 100644 --- a/retroshare-gui/src/gui/TheWire/PulseItem.h +++ b/retroshare-gui/src/gui/TheWire/PulseItem.h @@ -23,61 +23,37 @@ #include "ui_PulseItem.h" -#include - class PulseItem; class PulseHolder { - public: + public: virtual void deletePulseItem(PulseItem *, uint32_t ptype) = 0; virtual void notifySelection(PulseItem *item, int ptype) = 0; }; - -#define PHOTO_ITEM_TYPE_ALBUM 0x0001 -#define PHOTO_ITEM_TYPE_PHOTO 0x0002 -#define PHOTO_ITEM_TYPE_NEW 0x0003 - class PulseItem : public QWidget, private Ui::PulseItem { Q_OBJECT public: - PulseItem(PulseHolder *parent, const RsPhotoAlbum &album, const RsPhotoThumbnail &thumbnail); - PulseItem(PulseHolder *parent, const RsPhotoPhoto &photo, const RsPhotoThumbnail &thumbnail); - PulseItem(PulseHolder *parent, std::string url); // for new photos. + PulseItem(PulseHolder *parent, std::string url); - bool getPhotoThumbnail(RsPhotoThumbnail &nail); + void removeItem(); - void removeItem(); - - void setSelected(bool on); - bool isSelected(); - - const QPixmap *getPixmap(); - - // details are public - so that can be easily edited. - RsPhotoPhoto mDetails; - -//private slots: + void setSelected(bool on); + bool isSelected(); + const QPixmap *getPixmap(); protected: - void mousePressEvent(QMouseEvent *event); + void mousePressEvent(QMouseEvent *event); private: - void updateAlbumText(const RsPhotoAlbum &album); - void updatePhotoText(const RsPhotoPhoto &photo); - void updateImage(const RsPhotoThumbnail &thumbnail); - PulseHolder *mParent; - uint32_t mType; - - - bool mSelected; + PulseHolder *mParent; + uint32_t mType; + bool mSelected; }; - #endif - diff --git a/retroshare-gui/src/gui/TheWire/WireDialog.h b/retroshare-gui/src/gui/TheWire/WireDialog.h index 29b25c509..ae948b958 100644 --- a/retroshare-gui/src/gui/TheWire/WireDialog.h +++ b/retroshare-gui/src/gui/TheWire/WireDialog.h @@ -31,6 +31,8 @@ #include "gui/TheWire/PulseItem.h" #include "gui/TheWire/PulseAddDialog.h" +#define IMAGE_WIRE ":/images/kgames.png" + class WireDialog : public MainPage, public PulseHolder { Q_OBJECT @@ -38,6 +40,10 @@ class WireDialog : public MainPage, public PulseHolder public: WireDialog(QWidget *parent = 0); + virtual QIcon iconPixmap() const { return QIcon(IMAGE_WIRE) ; } + virtual QString pageName() const { return tr("The Wire") ; } + virtual QString helpText() const { return ""; } + virtual void deletePulseItem(PulseItem *, uint32_t type); virtual void notifySelection(PulseItem *item, int ptype); diff --git a/retroshare-gui/src/gui/WikiPoos/WikiDialog.cpp b/retroshare-gui/src/gui/WikiPoos/WikiDialog.cpp index a4be2189f..68e1adbb3 100644 --- a/retroshare-gui/src/gui/WikiPoos/WikiDialog.cpp +++ b/retroshare-gui/src/gui/WikiPoos/WikiDialog.cpp @@ -436,8 +436,8 @@ void WikiDialog::requestWikiPage(const RsGxsGrpMsgIdPair &msgId) uint32_t token; GxsMsgReq msgIds; - std::vector &vect_msgIds = msgIds[msgId.first]; - vect_msgIds.push_back(msgId.second); + std::set &set_msgIds = msgIds[msgId.first]; + set_msgIds.insert(msgId.second); mWikiQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, WIKIDIALOG_WIKI_PAGE); } @@ -698,10 +698,10 @@ void WikiDialog::updateDisplay(bool complete) requestGroupMeta(); } else { /* Update all groups of changed messages */ - std::map > msgIds; + std::map > msgIds; getAllMsgIds(msgIds); - std::map >::iterator msgIt; + std::map >::iterator msgIt; for (msgIt = msgIds.begin(); msgIt != msgIds.end(); ++msgIt) { wikiGroupChanged(QString::fromStdString(msgIt->first.toStdString())); } diff --git a/retroshare-gui/src/gui/WikiPoos/WikiDialog.h b/retroshare-gui/src/gui/WikiPoos/WikiDialog.h index c9c18c8b9..8b78f4774 100644 --- a/retroshare-gui/src/gui/WikiPoos/WikiDialog.h +++ b/retroshare-gui/src/gui/WikiPoos/WikiDialog.h @@ -32,7 +32,7 @@ #include -#define IMAGE_WIKI ":/images/wikibook_32.png" +#define IMAGE_WIKI ":/icons/png/wiki.png" class WikiAddDialog; class WikiEditDialog; diff --git a/retroshare-gui/src/gui/WikiPoos/WikiEditDialog.cpp b/retroshare-gui/src/gui/WikiPoos/WikiEditDialog.cpp index 2c5fc1b8d..b2f56d2c9 100644 --- a/retroshare-gui/src/gui/WikiPoos/WikiEditDialog.cpp +++ b/retroshare-gui/src/gui/WikiPoos/WikiEditDialog.cpp @@ -622,8 +622,8 @@ void WikiEditDialog::requestPage(const RsGxsGrpMsgIdPair &msgId) opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA; GxsMsgReq msgIds; - std::vector &vect_msgIds = msgIds[msgId.first]; - vect_msgIds.push_back(msgId.second); + std::set &set_msgIds = msgIds[msgId.first]; + set_msgIds.insert(msgId.second); uint32_t token; mWikiQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, WIKIEDITDIALOG_PAGE); diff --git a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h index 9955002fa..a067098d9 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h +++ b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h @@ -53,7 +53,7 @@ public: //GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost &post, bool isHome, bool autoUpdate); virtual ~GxsChannelPostItem(); - uint64_t uniqueIdentifier() const override { hash_64bits("GxsChannelPostItem " + messageId().toStdString()) ; } + uint64_t uniqueIdentifier() const override { return hash_64bits("GxsChannelPostItem " + messageId().toStdString()) ; } bool setGroup(const RsGxsChannelGroup &group, bool doFill = true); bool setPost(const RsGxsChannelPost &post, bool doFill = true); diff --git a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.ui b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.ui index 0e15c0a4d..1f869dc37 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.ui +++ b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.ui @@ -6,8 +6,8 @@ 0 0 - 1433 - 541 + 922 + 187 @@ -127,6 +127,19 @@
+ + + + Qt::Vertical + + + + 20 + 40 + + + + diff --git a/retroshare-gui/src/gui/feeds/PostedGroupItem.cpp b/retroshare-gui/src/gui/feeds/PostedGroupItem.cpp index 1a9ebeb9e..50cfb92d1 100644 --- a/retroshare-gui/src/gui/feeds/PostedGroupItem.cpp +++ b/retroshare-gui/src/gui/feeds/PostedGroupItem.cpp @@ -141,15 +141,15 @@ void PostedGroupItem::fill() GxsIdDetails::loadPixmapFromData(mGroup.mGroupImage.mData, mGroup.mGroupImage.mSize, postedImage,GxsIdDetails::ORIGINAL); ui->logoLabel->setPixmap(QPixmap(postedImage)); } else { - ui->logoLabel->setPixmap(QPixmap(":/images/posted_64.png")); + ui->logoLabel->setPixmap(QPixmap(":/icons/png/posted.png")); } //TODO - nice icon for subscribed group // if (IS_GROUP_PUBLISHER(mGroup.mMeta.mSubscribeFlags)) { -// ui->logoLabel->setPixmap(QPixmap(":/images/posted_64.png")); +// ui->logoLabel->setPixmap(QPixmap(":/icons/png/posted.png")); // } else { -// ui->logoLabel->setPixmap(QPixmap(":/images/posted_64.png")); +// ui->logoLabel->setPixmap(QPixmap(":/icons/png/posted.png")); // } if (IS_GROUP_SUBSCRIBED(mGroup.mMeta.mSubscribeFlags)) { @@ -160,11 +160,11 @@ void PostedGroupItem::fill() // if (mIsNew) // { - ui->titleLabel->setText(tr("New Posted")); + ui->titleLabel->setText(tr("New Board")); // } // else // { -// ui->titleLabel->setText(tr("Updated Posted")); +// ui->titleLabel->setText(tr("Updated Board")); // } if (mIsHome) diff --git a/retroshare-gui/src/gui/feeds/PostedGroupItem.ui b/retroshare-gui/src/gui/feeds/PostedGroupItem.ui index 2ebd46dbc..27226fd28 100644 --- a/retroshare-gui/src/gui/feeds/PostedGroupItem.ui +++ b/retroshare-gui/src/gui/feeds/PostedGroupItem.ui @@ -125,7 +125,10 @@ - :/images/posted_64.png + :/icons/png/posted.png + + + true @@ -147,7 +150,7 @@ - Posted + Board @@ -298,7 +301,7 @@ - Posted Description + Board Description @@ -321,7 +324,7 @@ Description - of Posted + of Board diff --git a/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp index c2d8b86e0..16991b72f 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp @@ -160,6 +160,15 @@ void GxsGroupDialog::init() Settings->loadWidgetInformation(this); } +void GxsGroupDialog::injectExtraWidget(QWidget *widget) +{ + // add extra widget into layout. + QVBoxLayout *vbox = new QVBoxLayout(); + vbox->addWidget(widget); + vbox->addStretch(1); + ui.extraFrame->setLayout(vbox); +} + QIcon GxsGroupDialog::serviceWindowIcon() { return qApp->windowIcon(); diff --git a/retroshare-gui/src/gui/gxs/GxsGroupDialog.h b/retroshare-gui/src/gui/gxs/GxsGroupDialog.h index 13cde700f..709ad4d6f 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupDialog.h +++ b/retroshare-gui/src/gui/gxs/GxsGroupDialog.h @@ -172,6 +172,13 @@ protected: virtual QPixmap serviceImage() = 0; virtual QIcon serviceWindowIcon(); + /*! + * Inject Extra Widget for additional Group configuration options. + * NB: These are only inserted for createMode currently. + * @param widget Addtional widget which is added to extraFrame. + */ + void injectExtraWidget(QWidget *widget); + /*! * \brief setUiToolTip/setUiText * Sets the text and tooltip of some parts of the UI diff --git a/retroshare-gui/src/gui/gxs/GxsGroupShareKey.cpp b/retroshare-gui/src/gui/gxs/GxsGroupShareKey.cpp index 7b3ac7fee..edc60012a 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupShareKey.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupShareKey.cpp @@ -93,9 +93,9 @@ void GroupShareKey::setTyp() if (!rsPosted) return; - ui->headerFrame->setHeaderImage(QPixmap(":/images/posted_64.png")); - ui->headerFrame->setHeaderText(tr("Share topic admin permissions")); - ui->sharekeyinfo_label->setText(tr("You can allow your friends to edit the topic. Select them in the list below. Note: it is not possible to revoke Posted admin permissions.")); + ui->headerFrame->setHeaderImage(QPixmap(":/icons/png/posted.png")); + ui->headerFrame->setHeaderText(tr("Share board admin permissions")); + ui->sharekeyinfo_label->setText(tr("You can allow your friends to edit the board. Select them in the list below. Note: it is not possible to revoke Board admin permissions.")); } else diff --git a/retroshare-gui/src/gui/icons.qrc b/retroshare-gui/src/gui/icons.qrc index 0e154fe7d..421582c92 100644 --- a/retroshare-gui/src/gui/icons.qrc +++ b/retroshare-gui/src/gui/icons.qrc @@ -288,9 +288,11 @@ icons/png/newsfeed2.png icons/png/postedlinks.png icons/png/people2.png + icons/png/photo.png icons/png/bandwidth.png icons/png/options2.png icons/png/exit2.png + icons/png/wiki.png icons/svg/addstickers.svg icons/png/addstickers.png icons/textedit/bold.png diff --git a/retroshare-gui/src/gui/icons/png/photo.png b/retroshare-gui/src/gui/icons/png/photo.png new file mode 100644 index 000000000..90ecc125e Binary files /dev/null and b/retroshare-gui/src/gui/icons/png/photo.png differ diff --git a/retroshare-gui/src/gui/icons/png/wiki.png b/retroshare-gui/src/gui/icons/png/wiki.png new file mode 100644 index 000000000..a85ba489a Binary files /dev/null and b/retroshare-gui/src/gui/icons/png/wiki.png differ diff --git a/retroshare-gui/src/gui/icons/svg/picture.svg b/retroshare-gui/src/gui/icons/svg/picture.svg new file mode 100644 index 000000000..76712ca1a --- /dev/null +++ b/retroshare-gui/src/gui/icons/svg/picture.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/retroshare-gui/src/gui/icons/svg/wiki.svg b/retroshare-gui/src/gui/icons/svg/wiki.svg new file mode 100644 index 000000000..ed4ca738e --- /dev/null +++ b/retroshare-gui/src/gui/icons/svg/wiki.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/retroshare-gui/src/gui/settings/PostedPage.cpp b/retroshare-gui/src/gui/settings/PostedPage.cpp index 107c49074..f4c178705 100644 --- a/retroshare-gui/src/gui/settings/PostedPage.cpp +++ b/retroshare-gui/src/gui/settings/PostedPage.cpp @@ -30,7 +30,7 @@ PostedPage::PostedPage(QWidget * parent, Qt::WindowFlags flags) setAttribute(Qt::WA_QuitOnClose, false); /* Initialize GroupFrameSettingsWidget */ - ui->groupFrameSettingsWidget->setOpenAllInNewTabText(tr("Open each topic in a new tab")); + ui->groupFrameSettingsWidget->setOpenAllInNewTabText(tr("Open each board in a new tab")); ui->groupFrameSettingsWidget->setType(GroupFrameSettings::Posted); } diff --git a/retroshare-gui/src/gui/settings/PostedPage.h b/retroshare-gui/src/gui/settings/PostedPage.h index d8189e509..ba6515d8c 100644 --- a/retroshare-gui/src/gui/settings/PostedPage.h +++ b/retroshare-gui/src/gui/settings/PostedPage.h @@ -39,7 +39,7 @@ public: virtual void load(); virtual QPixmap iconPixmap() const { return QPixmap(":/icons/settings/posted.svg") ; } - virtual QString pageName() const { return tr("Links") ; } + virtual QString pageName() const { return tr("Boards") ; } virtual QString helpText() const { return ""; } private: diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro index 1f9b76851..44f126dc5 100644 --- a/retroshare-gui/src/retroshare-gui.pro +++ b/retroshare-gui/src/retroshare-gui.pro @@ -114,6 +114,11 @@ CONFIG += gxscircles #CONFIG += framecatcher #CONFIG += blogs +## To enable unfinished services +#CONFIG += wikipoos +#CONFIG += gxsthewire +#CONFIG += gxsphotoshare + DEFINES += RS_RELEASE_VERSION RCC_DIR = temp/qrc UI_DIR = temp/ui @@ -342,6 +347,7 @@ openbsd-* { wikipoos { PRE_TARGETDEPS *= $$OUT_PWD/../../supportlibs/pegmarkdown/lib/libpegmarkdown.a LIBS *= $$OUT_PWD/../../supportlibs/pegmarkdown/lib/libpegmarkdown.a + LIBS *= -lglib-2.0 } # Tor controller @@ -1147,9 +1153,12 @@ unfinished_services { gxsphotoshare { - #DEFINES += RS_USE_PHOTOSHARE + #DEFINES += RS_USE_PHOTOSHARE # to enable in unfinished. + DEFINES += RS_USE_PHOTO # enable in MainWindow HEADERS += \ + gui/PhotoShare/AlbumGroupDialog.h \ + gui/PhotoShare/AlbumExtra.h \ gui/PhotoShare/PhotoDrop.h \ gui/PhotoShare/AlbumItem.h \ gui/PhotoShare/AlbumDialog.h \ @@ -1163,6 +1172,7 @@ gxsphotoshare { gui/PhotoShare/AddCommentDialog.h FORMS += \ + gui/PhotoShare/AlbumExtra.ui \ gui/PhotoShare/PhotoItem.ui \ gui/PhotoShare/PhotoDialog.ui \ gui/PhotoShare/AlbumItem.ui \ @@ -1174,6 +1184,8 @@ gxsphotoshare { gui/PhotoShare/AddCommentDialog.ui SOURCES += \ + gui/PhotoShare/AlbumGroupDialog.cpp \ + gui/PhotoShare/AlbumExtra.cpp \ gui/PhotoShare/PhotoItem.cpp \ gui/PhotoShare/PhotoDialog.cpp \ gui/PhotoShare/PhotoDrop.cpp \ @@ -1192,6 +1204,7 @@ gxsphotoshare { wikipoos { + DEFINES += RS_USE_WIKI DEPENDPATH += ../../supportlibs/pegmarkdown INCLUDEPATH += ../../supportlibs/pegmarkdown @@ -1218,6 +1231,8 @@ wikipoos { gxsthewire { + DEFINES += RS_USE_WIRE + HEADERS += gui/TheWire/PulseItem.h \ gui/TheWire/WireDialog.h \ gui/TheWire/PulseAddDialog.h \