Switch PhotoService to use GxsComments

WIP improvements to PhotoService:
 - switch p3photoservice to use gxcommentservice
 - clean out old RsPhotoComment classes
 - redesign PhotoDialog to use standard GxsCommentService classes
 - remove unneeded old Comment classes from GUI
 - fix indenting for PhotoDialog and p3photoservice.h
 - fix layout issue in Extra Widgets for GxsGroupDialog
This commit is contained in:
drbob 2020-02-16 15:21:20 +11:00
parent 01b39bfe63
commit fe62dc1345
16 changed files with 484 additions and 1210 deletions

View File

@ -25,8 +25,10 @@
#include <inttypes.h>
#include <string>
#include <list>
#include "rsgxsservice.h"
#include "rsgxscommon.h"
#include "retroshare/rsgxsservice.h"
#include "retroshare/rsgxscommon.h"
#include "retroshare/rsgxsifacehelper.h"
/* The Main Interface Class - for information about your Peers */
class RsPhoto;
@ -135,30 +137,13 @@ class RsPhotoAlbum
uint32_t mModFlags;
};
class RsGxsPhotoCommentItem;
class RsPhotoComment
{
public:
RsPhotoComment();
explicit RsPhotoComment(const RsGxsPhotoCommentItem& comment);
RsPhotoComment& operator=(const RsGxsPhotoCommentItem& comment);
RsMsgMetaData mMeta;
std::string mComment;
uint32_t mCommentFlag;
};
std::ostream &operator<<(std::ostream &out, const RsPhotoPhoto &photo);
std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album);
typedef std::map<RsGxsGroupId, std::vector<RsPhotoPhoto> > PhotoResult;
typedef std::map<RsGxsGroupId, std::vector<RsPhotoComment> > PhotoCommentResult;
typedef std::map<RsGxsGrpMsgIdPair, std::vector<RsPhotoComment> > PhotoRelatedCommentResult;
class RsPhoto
class RsPhoto: public RsGxsIfaceHelper, public RsGxsCommentService
{
public:
@ -168,7 +153,7 @@ public:
static const uint32_t FLAG_MSG_TYPE_MASK;
RsPhoto() { return; }
explicit RsPhoto(RsGxsIface &gxs) : RsGxsIfaceHelper(gxs) { return; }
virtual ~RsPhoto() { return; }
@ -235,7 +220,7 @@ public:
virtual bool getMsgSummary(const uint32_t &token,
MsgMetaResult &msgInfo) = 0;
/* Specific Service Data */
/* Specific Service Data */
/*!
* @param token token to be redeemed for album request
@ -252,22 +237,6 @@ public:
virtual bool getPhoto(const uint32_t &token,
PhotoResult &photo) = 0;
/* details are updated in album - to choose Album ID, and storage path */
/*!
* @param token token to be redeemed for photo request
* @param photo the photo returned for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getPhotoComment(const uint32_t &token,
PhotoCommentResult& comments) = 0;
/*!
* @param token token to be redeemed for photo request
* @param photo the photo returned for given request token
* @return false if request token is invalid, check token status for error report
*/
virtual bool getPhotoRelatedComment(const uint32_t &token, PhotoRelatedCommentResult &comments) = 0;
/*!
* submits album, which returns a token that needs
* to be acknowledge to get album grp id
@ -284,16 +253,6 @@ public:
*/
virtual bool submitPhoto(uint32_t& token, RsPhotoPhoto &photo) = 0;
/*!
* submits photo comment, which returns a token that needs
* to be acknowledged to get photo msg-grp id pair
* The mParentId needs to be set to an existing msg for which
* commenting is enabled
* @param token token to redeem for acknowledgement
* @param comment comment to be submitted
*/
virtual bool submitComment(uint32_t& token, RsPhotoComment &photo) = 0;
/*!
* subscribes to group, and returns token which can be used
* to be acknowledged to get group Id

View File

@ -33,11 +33,10 @@ RsItem *RsGxsPhotoSerialiser::create_item(uint16_t service, uint8_t item_sub_id)
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 ;
return RsGxsCommentSerialiser::create_item(service,item_sub_id) ;
}
}
@ -68,11 +67,6 @@ void RsGxsPhotoPhotoItem::serial_process(RsGenericSerializer::SerializeJob j,RsG
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<uint32_t>(j,ctx,comment.mCommentFlag,"mCommentFlag");
}
void RsGxsPhotoAlbumItem::clear()
{
@ -88,12 +82,6 @@ void RsGxsPhotoAlbumItem::clear()
album.mThumbnail.clear();
}
void RsGxsPhotoCommentItem::clear()
{
comment.mComment.clear();
comment.mCommentFlag = 0;
}
void RsGxsPhotoPhotoItem::clear()
{
photo.mCaption.clear();

View File

@ -26,6 +26,7 @@
#include "rsitems/rsserviceids.h"
#include "rsitems/rsgxsitems.h"
#include "rsitems/rsgxscommentitems.h"
#include "serialiser/rsserial.h"
#include "serialiser/rsserializer.h"
@ -34,7 +35,6 @@
const uint8_t RS_PKT_SUBTYPE_PHOTO_ITEM = 0x02;
const uint8_t RS_PKT_SUBTYPE_PHOTO_SHOW_ITEM = 0x03;
const uint8_t RS_PKT_SUBTYPE_PHOTO_COMMENT_ITEM = 0x04;
class RsGxsPhotoAlbumItem : public RsGxsGrpItem
{
@ -66,24 +66,11 @@ public:
RsPhotoPhoto photo;
};
class RsGxsPhotoCommentItem : public RsGxsMsgItem
class RsGxsPhotoSerialiser : public RsGxsCommentSerialiser
{
public:
RsGxsPhotoCommentItem(): RsGxsMsgItem(RS_SERVICE_GXS_TYPE_PHOTO, RS_PKT_SUBTYPE_PHOTO_COMMENT_ITEM) {}
virtual ~RsGxsPhotoCommentItem() {}
void clear();
virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx);
RsPhotoComment comment;
};
class RsGxsPhotoSerialiser : public RsServiceSerializer
{
public:
RsGxsPhotoSerialiser() :RsServiceSerializer(RS_SERVICE_GXS_TYPE_PHOTO) {}
RsGxsPhotoSerialiser() :RsGxsCommentSerialiser(RS_SERVICE_GXS_TYPE_PHOTO) {}
virtual ~RsGxsPhotoSerialiser() {}
virtual RsItem *create_item(uint16_t service, uint8_t item_sub_id) const;

View File

@ -42,18 +42,6 @@ RsPhotoAlbum::RsPhotoAlbum()
return;
}
RsPhotoComment::RsPhotoComment()
: mComment(""), mCommentFlag(0) {
}
RsPhotoComment::RsPhotoComment(const RsGxsPhotoCommentItem &comment)
: mComment(""), mCommentFlag(0) {
*this = comment.comment;
(*this).mMeta = comment.meta;
}
std::ostream &operator<<(std::ostream &out, const RsPhotoPhoto &photo)
{
out << "RsPhotoPhoto [ ";
@ -62,7 +50,6 @@ std::ostream &operator<<(std::ostream &out, const RsPhotoPhoto &photo)
return out;
}
std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album)
{
out << "RsPhotoAlbum [ ";
@ -73,8 +60,10 @@ std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album)
p3PhotoService::p3PhotoService(RsGeneralDataService* gds, RsNetworkExchangeService* nes, RsGixs* gixs)
: RsGenExchange(gds, nes, new RsGxsPhotoSerialiser(), RS_SERVICE_GXS_TYPE_PHOTO, gixs, photoAuthenPolicy()),
RsPhoto(static_cast<RsGxsIface&>(*this)),
mPhotoMutex(std::string("Photo Mutex"))
{
mCommentService = new p3GxsCommentService(this, RS_SERVICE_GXS_TYPE_PHOTO);
}
const std::string GXS_PHOTO_APP_NAME = "gxsphoto";
@ -93,8 +82,6 @@ RsServiceInfo p3PhotoService::getServiceInfo()
GXS_PHOTO_MIN_MINOR_VERSION);
}
uint32_t p3PhotoService::photoAuthenPolicy()
{
uint32_t policy = 0;
@ -124,11 +111,10 @@ bool p3PhotoService::updated()
void p3PhotoService::service_tick()
{
mCommentService->comment_tick();
}
void p3PhotoService::groupsChanged(std::list<RsGxsGroupId>& grpIds)
{
RsStackMutex stack(mPhotoMutex);
@ -267,54 +253,6 @@ bool p3PhotoService::getPhoto(const uint32_t& token, PhotoResult& photos)
return ok;
}
bool p3PhotoService::getPhotoComment(const uint32_t &token, PhotoCommentResult &comments)
{
GxsMsgDataMap msgData;
bool ok = RsGenExchange::getMsgData(token, msgData);
if(ok)
{
GxsMsgDataMap::iterator mit = msgData.begin();
for(; mit != msgData.end(); ++mit)
{
RsGxsGroupId grpId = mit->first;
std::vector<RsGxsMsgItem*>& msgItems = mit->second;
std::vector<RsGxsMsgItem*>::iterator vit = msgItems.begin();
for(; vit != msgItems.end(); ++vit)
{
RsGxsPhotoCommentItem* item = dynamic_cast<RsGxsPhotoCommentItem*>(*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;
}
RsPhotoComment& RsPhotoComment::operator=(const RsGxsPhotoCommentItem& comment)
{
*this = comment.comment;
return *this;
}
bool p3PhotoService::getPhotoRelatedComment(const uint32_t &token, PhotoRelatedCommentResult &comments)
{
return RsGenExchange::getMsgRelatedDataT<RsGxsPhotoCommentItem, RsPhotoComment>(token, comments);
}
bool p3PhotoService::submitAlbumDetails(uint32_t& token, RsPhotoAlbum& album)
{
RsGxsPhotoAlbumItem* albumItem = new RsGxsPhotoAlbumItem();
@ -324,8 +262,6 @@ bool p3PhotoService::submitAlbumDetails(uint32_t& token, RsPhotoAlbum& album)
return true;
}
void p3PhotoService::notifyChanges(std::vector<RsGxsNotify*>& changes)
{
@ -363,17 +299,6 @@ bool p3PhotoService::submitPhoto(uint32_t& token, RsPhotoPhoto& photo)
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;
RsGenExchange::publishMsg(token, commentItem);
return true;
}
bool p3PhotoService::acknowledgeMsg(const uint32_t& token,
std::pair<RsGxsGroupId, RsGxsMessageId>& msgId)
{
@ -397,4 +322,3 @@ bool p3PhotoService::subscribeToAlbum(uint32_t &token, const RsGxsGroupId &grpId
return true;
}

View File

@ -24,122 +24,154 @@
#include "gxs/rsgenexchange.h"
#include "retroshare/rsphoto.h"
#include "services/p3gxscommon.h"
class p3PhotoService : public RsPhoto, public RsGenExchange
class p3PhotoService : public RsGenExchange, public RsPhoto
{
public:
p3PhotoService(RsGeneralDataService* gds, RsNetworkExchangeService* nes, RsGixs* gixs);
virtual RsServiceInfo getServiceInfo();
p3PhotoService(RsGeneralDataService* gds, RsNetworkExchangeService* nes, RsGixs* gixs);
virtual RsServiceInfo getServiceInfo();
static uint32_t photoAuthenPolicy();
static uint32_t photoAuthenPolicy();
public:
/*!
* @return true if a change has occured
*/
bool updated();
/*!
* @return true if a change has occured
*/
bool updated();
/*!
*
*/
void service_tick();
/*!
*
*/
void service_tick();
protected:
void notifyChanges(std::vector<RsGxsNotify*>& changes);
void notifyChanges(std::vector<RsGxsNotify*>& changes);
public:
/** Requests **/
/** Requests **/
void groupsChanged(std::list<RsGxsGroupId>& grpIds);
void groupsChanged(std::list<RsGxsGroupId>& grpIds);
void msgsChanged(GxsMsgIdResult& msgs);
void msgsChanged(GxsMsgIdResult& msgs);
RsTokenService* getTokenService();
RsTokenService* getTokenService();
bool getGroupList(const uint32_t &token,
std::list<RsGxsGroupId> &groupIds);
bool getMsgList(const uint32_t &token,
GxsMsgIdResult& msgIds);
bool getGroupList(const uint32_t &token, std::list<RsGxsGroupId> &groupIds);
bool getMsgList(const uint32_t &token, GxsMsgIdResult& msgIds);
/* Generic Summary */
bool getGroupSummary(const uint32_t &token,
std::list<RsGroupMetaData> &groupInfo);
/* Generic Summary */
bool getGroupSummary(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo);
bool getMsgSummary(const uint32_t &token,
MsgMetaResult &msgInfo);
bool getMsgSummary(const uint32_t &token, MsgMetaResult &msgInfo);
/* Specific Service Data */
bool getAlbum(const uint32_t &token, std::vector<RsPhotoAlbum> &albums);
bool getPhoto(const uint32_t &token, PhotoResult &photos);
bool getPhotoComment(const uint32_t &token, PhotoCommentResult &comments);
bool getPhotoRelatedComment(const uint32_t &token, PhotoRelatedCommentResult &comments);
/* Specific Service Data */
bool getAlbum(const uint32_t &token, std::vector<RsPhotoAlbum> &albums);
bool getPhoto(const uint32_t &token, PhotoResult &photos);
public:
/* Comment service - Provide RsGxsCommentService - redirect to p3GxsCommentService */
virtual bool getCommentData(uint32_t token, std::vector<RsGxsComment> &msgs) override
{
return mCommentService->getGxsCommentData(token, msgs);
}
virtual bool getRelatedComments( uint32_t token, std::vector<RsGxsComment> &msgs ) override
{
return mCommentService->getGxsRelatedComments(token, msgs);
}
virtual bool createNewComment(uint32_t &token, RsGxsComment &msg) override
{
return mCommentService->createGxsComment(token, msg);
}
virtual bool createNewVote(uint32_t &token, RsGxsVote &msg) override
{
return mCommentService->createGxsVote(token, msg);
}
virtual bool acknowledgeComment(uint32_t token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId) override
{
return acknowledgeMsg(token, msgId);
}
virtual bool acknowledgeVote(uint32_t token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId) override
{
if (mCommentService->acknowledgeVote(token, msgId))
{
return true;
}
return acknowledgeMsg(token, msgId);
}
public:
/** Modifications **/
/** Modifications **/
/*!
* submits album, which returns a token that needs
* to be acknowledge to get album grp id
* @param token token to redeem for acknowledgement
* @param album album to be submitted
*/
bool submitAlbumDetails(uint32_t& token, RsPhotoAlbum &album);
/*!
* submits album, which returns a token that needs
* to be acknowledge to get album grp id
* @param token token to redeem for acknowledgement
* @param album album to be submitted
*/
bool submitAlbumDetails(uint32_t& token, RsPhotoAlbum &album);
/*!
* submits photo, which returns a token that needs
* to be acknowledge to get photo msg-grp id pair
* @param token token to redeem for acknowledgement
* @param photo photo to be submitted
*/
bool submitPhoto(uint32_t& token, RsPhotoPhoto &photo);
/*!
* submits photo, which returns a token that needs
* to be acknowledge to get photo msg-grp id pair
* @param token token to redeem for acknowledgement
* @param photo photo to be submitted
*/
bool submitPhoto(uint32_t& token, RsPhotoPhoto &photo);
/*!
* submits photo comment, which returns a token that needs
* to be acknowledged to get photo msg-grp id pair
* The mParentId needs to be set to an existing msg for which
* commenting is enabled
* @param token token to redeem for acknowledgement
* @param comment comment to be submitted
*/
bool submitComment(uint32_t& token, RsPhotoComment &photo);
/*!
* submits photo comment, which returns a token that needs
* to be acknowledged to get photo msg-grp id pair
* The mParentId needs to be set to an existing msg for which
* commenting is enabled
* @param token token to redeem for acknowledgement
* @param comment comment to be submitted
*/
// bool submitComment(uint32_t& token, RsPhotoComment &photo);
/*!
* subscribes to group, and returns token which can be used
* to be acknowledged to get group Id
* @param token token to redeem for acknowledgement
* @param grpId the id of the group to subscribe to
*/
bool subscribeToAlbum(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe);
/*!
* subscribes to group, and returns token which can be used
* to be acknowledged to get group Id
* @param token token to redeem for acknowledgement
* @param grpId the id of the group to subscribe to
*/
bool subscribeToAlbum(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe);
/*!
* This allows the client service to acknowledge that their msgs has
* been created/modified and retrieve the create/modified msg ids
* @param token the token related to modification/create request
* @param msgIds map of grpid->msgIds of message created/modified
* @return true if token exists false otherwise
*/
bool acknowledgeMsg(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId);
/*!
* This allows the client service to acknowledge that their msgs has
* been created/modified and retrieve the create/modified msg ids
* @param token the token related to modification/create request
* @param msgIds map of grpid->msgIds of message created/modified
* @return true if token exists false otherwise
*/
bool acknowledgeMsg(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId);
/*!
/*!
* This allows the client service to acknowledge that their grps has
* been created/modified and retrieve the create/modified grp ids
* @param token the token related to modification/create request
* @param msgIds vector of ids of groups created/modified
* @return true if token exists false otherwise
*/
bool acknowledgeGrp(const uint32_t& token, RsGxsGroupId& grpId);
bool acknowledgeGrp(const uint32_t& token, RsGxsGroupId& grpId);
private:
p3GxsCommentService* mCommentService;
std::vector<RsGxsGroupChange*> mGroupChange;
std::vector<RsGxsMsgChange*> mMsgChange;
std::vector<RsGxsGroupChange*> mGroupChange;
std::vector<RsGxsMsgChange*> mMsgChange;
RsMutex mPhotoMutex;
RsMutex mPhotoMutex;
};
#endif // P3PHOTOSERVICEV2_H

View File

@ -1,39 +0,0 @@
/*******************************************************************************
* retroshare-gui/src/gui/PhotoShare/AddCommentDialog.cpp *
* *
* Copyright (C) 2018 by Retroshare Team <retroshare.project@gmail.com> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "AddCommentDialog.h"
#include "ui_AddCommentDialog.h"
AddCommentDialog::AddCommentDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::AddCommentDialog)
{
ui->setupUi(this);
}
AddCommentDialog::~AddCommentDialog()
{
delete ui;
}
QString AddCommentDialog::getComment() const
{
return ui->textEditAddComment->document()->toPlainText();
}

View File

@ -1,43 +0,0 @@
/*******************************************************************************
* retroshare-gui/src/gui/PhotoShare/AddCommentDialog.h *
* *
* Copyright (C) 2018 by Retroshare Team <retroshare.project@gmail.com> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef ADDCOMMENTDIALOG_H
#define ADDCOMMENTDIALOG_H
#include <QDialog>
namespace Ui {
class AddCommentDialog;
}
class AddCommentDialog : public QDialog
{
Q_OBJECT
public:
explicit AddCommentDialog(QWidget *parent = 0);
~AddCommentDialog();
QString getComment() const;
private:
Ui::AddCommentDialog *ui;
};
#endif // ADDCOMMENTDIALOG_H

View File

@ -1,67 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AddCommentDialog</class>
<widget class="QDialog" name="AddCommentDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>370</width>
<height>118</height>
</rect>
</property>
<property name="windowTitle">
<string>Add Comment</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTextEdit" name="textEditAddComment"/>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>AddCommentDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>AddCommentDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -1,52 +0,0 @@
/*******************************************************************************
* retroshare-gui/src/gui/PhotoShare/PhotoCommentItem.cpp *
* *
* Copyright (C) 2018 by Retroshare Team <retroshare.project@gmail.com> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include <QDateTime>
#include "PhotoCommentItem.h"
#include "ui_PhotoCommentItem.h"
PhotoCommentItem::PhotoCommentItem(const RsPhotoComment& comment, QWidget *parent):
QWidget(parent),
ui(new Ui::PhotoCommentItem), mComment(comment)
{
ui->setupUi(this);
setUp();
}
PhotoCommentItem::~PhotoCommentItem()
{
delete ui;
}
const RsPhotoComment& PhotoCommentItem::getComment()
{
return mComment;
}
void PhotoCommentItem::setUp()
{
ui->labelComment->setText(QString::fromUtf8(mComment.mComment.c_str()));
QDateTime qtime;
qtime.setTime_t(mComment.mMeta.mPublishTs);
QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm");
ui->datetimelabel->setText(timestamp);
}

View File

@ -1,49 +0,0 @@
/*******************************************************************************
* retroshare-gui/src/gui/PhotoShare/PhotoCommentItem.h *
* *
* Copyright (C) 2018 by Retroshare Team <retroshare.project@gmail.com> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef PHOTOCOMMENTITEM_H
#define PHOTOCOMMENTITEM_H
#include <QWidget>
#include "retroshare/rsphoto.h"
namespace Ui {
class PhotoCommentItem;
}
class PhotoCommentItem : public QWidget
{
Q_OBJECT
public:
explicit PhotoCommentItem(const RsPhotoComment& comment, QWidget *parent = 0);
~PhotoCommentItem();
const RsPhotoComment& getComment();
private:
void setUp();
private:
Ui::PhotoCommentItem *ui;
RsPhotoComment mComment;
};
#endif // PHOTOCOMMENTITEM_H

View File

@ -1,200 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PhotoCommentItem</class>
<widget class="QWidget" name="PhotoCommentItem">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>338</width>
<height>60</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="expandFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>400</width>
<height>71</height>
</size>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>237</red>
<green>239</green>
<blue>244</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>237</red>
<green>239</green>
<blue>244</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>237</red>
<green>239</green>
<blue>244</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>237</red>
<green>239</green>
<blue>244</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>2</number>
</property>
<property name="spacing">
<number>2</number>
</property>
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/no_avatar_70.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1" rowspan="2" colspan="2">
<widget class="QLabel" name="labelComment">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>29</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLabel" name="datetimelabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:600; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt; color:#666666;&quot;&gt;DateTime&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -23,235 +23,168 @@
#include "PhotoDialog.h"
#include "ui_PhotoDialog.h"
#include "retroshare/rsidentity.h"
#include "AddCommentDialog.h"
#include "gui/gxs/GxsCommentDialog.h"
PhotoDialog::PhotoDialog(RsPhoto *rs_photo, const RsPhotoPhoto &photo, QWidget *parent) :
QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
ui(new Ui::PhotoDialog), mRsPhoto(rs_photo), mPhotoQueue(new TokenQueue(mRsPhoto->getTokenService(), this)),
mPhotoDetails(photo)
QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
ui(new Ui::PhotoDialog), mRsPhoto(rs_photo), mPhotoQueue(new TokenQueue(mRsPhoto->getTokenService(), this)),
mPhotoDetails(photo),
mCommentsCreated(false)
{
ui->setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
ui->setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
connect(ui->pushButton_AddComment, SIGNAL(clicked()), this, SLOT(createComment()));
connect(ui->pushButton_AddCommentDlg, SIGNAL(clicked()), this, SLOT(addComment()));
connect(ui->fullscreenButton, SIGNAL(clicked()),this, SLOT(setFullScreen()));
connect(ui->fullscreenButton, SIGNAL(clicked()),this, SLOT(setFullScreen()));
connect(ui->commentsButton, SIGNAL(clicked()),this, SLOT(toggleComments()));
connect(ui->detailsButton, SIGNAL(clicked()),this, SLOT(toggleDetails()));
#if QT_VERSION >= 0x040700
ui->lineEdit->setPlaceholderText(tr("Write a comment...")) ;
#endif
setUp();
setUp();
}
PhotoDialog::~PhotoDialog()
{
delete ui;
delete mPhotoQueue;
delete ui;
delete mPhotoQueue;
}
void PhotoDialog::setUp()
{
QPixmap qtn;
qtn.loadFromData(mPhotoDetails.mThumbnail.mData, mPhotoDetails.mThumbnail.mSize, "PNG");
ui->label_Photo->setPixmap(qtn);
ui->lineEdit_Title->setText(QString::fromStdString(mPhotoDetails.mMeta.mMsgName));
QPixmap qtn;
qtn.loadFromData(mPhotoDetails.mThumbnail.mData, mPhotoDetails.mThumbnail.mSize, "PNG");
ui->label_Photo->setPixmap(qtn);
ui->label_Photo->setVisible(true);
requestComments();
// set size of label to match image.
ui->label_Photo->setMinimumSize(ui->label_Photo->sizeHint());
// alternative is to scale contents.
// ui->label_Photo->setScaledContents(true);
// Neither are ideal. sizeHint is potentially too large.
// scaled contents - doesn't respect Aspect Ratio...
//
// Ideal soln:
// Allow both, depending on Zoom Factor.
// Auto: use Scale, with correct aspect ratio.
// answer here: https://stackoverflow.com/questions/8211982/qt-resizing-a-qlabel-containing-a-qpixmap-while-keeping-its-aspect-ratio
// Fixed %, then manually scale to that, with scroll area.
ui->lineEdit_Title->setText(QString::fromStdString(mPhotoDetails.mMeta.mMsgName));
ui->frame_comments->setVisible(false);
ui->frame_details->setVisible(false);
}
void PhotoDialog::addComment()
void PhotoDialog::toggleDetails()
{
AddCommentDialog dlg(this);
if (dlg.exec() == QDialog::Accepted) {
RsPhotoComment comment;
comment.mComment = dlg.getComment().toUtf8().constData();
uint32_t token;
comment.mMeta.mGroupId = mPhotoDetails.mMeta.mGroupId;
comment.mMeta.mParentId = mPhotoDetails.mMeta.mOrigMsgId;
mRsPhoto->submitComment(token, comment);
mPhotoQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
}
if (ui->frame_details->isVisible()) {
ui->frame_details->setVisible(false);
} else {
ui->frame_details->setVisible(true);
}
}
void PhotoDialog::clearComments()
void PhotoDialog::toggleComments()
{
//QLayout* l = ui->scrollAreaWidgetContents->layout();
QSetIterator<PhotoCommentItem*> sit(mComments);
while(sit.hasNext())
{
PhotoCommentItem* item = sit.next();
ui->verticalLayout->removeWidget(item);
item->setParent(NULL);
delete item;
}
if (ui->frame_comments->isVisible()) {
ui->frame_comments->setVisible(false);
} else {
if (mCommentsCreated) {
ui->frame_comments->setVisible(true);
} else {
// create CommentDialog.
RsGxsCommentService *commentService = dynamic_cast<RsGxsCommentService *>(mRsPhoto);
GxsCommentDialog *commentDialog = new GxsCommentDialog(this, mRsPhoto->getTokenService(), commentService);
mComments.clear();
// TODO: Need to fetch all msg versions, otherwise - won't get all the comments.
// For the moment - use current msgid.
// Needs to be passed to PhotoDialog, or fetched here.
RsGxsGroupId grpId = mPhotoDetails.mMeta.mGroupId;
RsGxsMessageId msgId = mPhotoDetails.mMeta.mMsgId;
std::set<RsGxsMessageId> msgv;
msgv.insert(msgId);
msgv.insert(mPhotoDetails.mMeta.mOrigMsgId); // if duplicate will be ignored.
commentDialog->commentLoad(grpId, msgv,msgId);
// insert into frame.
QVBoxLayout *vbox = new QVBoxLayout();
vbox->addWidget(commentDialog);
ui->frame_comments->setLayout(vbox);
ui->frame_comments->setVisible(true);
mCommentsCreated = true;
}
}
}
void PhotoDialog::resetComments()
{
QSetIterator<PhotoCommentItem*> sit(mComments);
//QLayout* l = ui->scrollAreaWidgetContents->layout();
while(sit.hasNext())
{
PhotoCommentItem* item = sit.next();
ui->verticalLayout->insertWidget(0,item);
}
}
void PhotoDialog::requestComments()
{
RsTokReqOptions opts;
opts.mMsgFlagMask = RsPhoto::FLAG_MSG_TYPE_MASK;
opts.mMsgFlagFilter = RsPhoto::FLAG_MSG_TYPE_PHOTO_COMMENT;
opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
opts.mReqType = GXS_REQUEST_TYPE_MSG_RELATED_DATA;
opts.mOptions = RS_TOKREQOPT_MSG_PARENT | RS_TOKREQOPT_MSG_LATEST;
RsGxsGrpMsgIdPair msgId;
uint32_t token;
msgId.first = mPhotoDetails.mMeta.mGroupId;
msgId.second = mPhotoDetails.mMeta.mMsgId;
std::vector<RsGxsGrpMsgIdPair> msgIdV;
msgIdV.push_back(msgId);
mPhotoQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIdV, 0);
}
void PhotoDialog::createComment()
{
RsPhotoComment comment;
QString commentString = ui->lineEdit->text();
comment.mComment = commentString.toUtf8().constData();
uint32_t token;
comment.mMeta.mGroupId = mPhotoDetails.mMeta.mGroupId;
comment.mMeta.mParentId = mPhotoDetails.mMeta.mOrigMsgId;
mRsPhoto->submitComment(token, comment);
mPhotoQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
ui->lineEdit->clear();
}
/*************** message loading **********************/
void PhotoDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
{
std::cerr << "PhotoShare::loadRequest()";
std::cerr << std::endl;
std::cerr << "PhotoShare::loadRequest()";
std::cerr << std::endl;
if (queue == mPhotoQueue)
{
/* now switch on req */
switch(req.mType)
{
case TOKENREQ_MSGINFO:
{
switch(req.mAnsType)
{
case RS_TOKREQ_ANSTYPE_DATA:
loadComment(req.mToken);
break;
case RS_TOKREQ_ANSTYPE_LIST:
loadList(req.mToken);
break;
case RS_TOKREQ_ANSTYPE_ACK:
acknowledgeComment(req.mToken);
break;
default:
std::cerr << "PhotoShare::loadRequest() ERROR: MSG INVALID TYPE";
std::cerr << std::endl;
break;
}
break;
}
if (queue == mPhotoQueue)
{
/* now switch on req */
switch(req.mType)
{
case TOKENREQ_MSGINFO:
{
switch(req.mAnsType)
{
case RS_TOKREQ_ANSTYPE_LIST:
loadList(req.mToken);
break;
default:
std::cerr << "PhotoShare::loadRequest() ERROR: MSG INVALID TYPE";
std::cerr << std::endl;
break;
}
break;
}
default:
{
std::cerr << "PhotoShare::loadRequest() ERROR: INVALID TYPE";
std::cerr << std::endl;
break;
}
}
}
default:
{
std::cerr << "PhotoShare::loadRequest() ERROR: INVALID TYPE";
std::cerr << std::endl;
break;
}
}
}
}
void PhotoDialog::loadComment(uint32_t token)
{
clearComments();
PhotoRelatedCommentResult results;
mRsPhoto->getPhotoRelatedComment(token, results);
PhotoRelatedCommentResult::iterator mit = results.begin();
for(; mit != results.end(); ++mit)
{
const std::vector<RsPhotoComment>& commentV = mit->second;
std::vector<RsPhotoComment>::const_iterator vit = commentV.begin();
for(; vit != commentV.end(); ++vit)
{
addComment(*vit);
}
}
resetComments();
}
void PhotoDialog::loadList(uint32_t token)
{
GxsMsgReq msgIds;
mRsPhoto->getMsgList(token, msgIds);
RsTokReqOptions opts;
GxsMsgReq msgIds;
mRsPhoto->getMsgList(token, msgIds);
RsTokReqOptions opts;
// just use data as no need to worry about getting comments
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
uint32_t reqToken;
mPhotoQueue->requestMsgInfo(reqToken, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, 0);
}
void PhotoDialog::addComment(const RsPhotoComment &comment)
{
PhotoCommentItem* item = new PhotoCommentItem(comment);
mComments.insert(item);
}
void PhotoDialog::acknowledgeComment(uint32_t token)
{
RsGxsGrpMsgIdPair msgId;
mRsPhoto->acknowledgeMsg(token, msgId);
if(msgId.first.isNull() || msgId.second.isNull()){
}else
{
requestComments();
}
// just use data as no need to worry about getting comments
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
uint32_t reqToken;
mPhotoQueue->requestMsgInfo(reqToken, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, 0);
}
void PhotoDialog::setFullScreen()
{
if (!isFullScreen()) {
// hide menu & toolbars
// hide menu & toolbars
#ifdef Q_OS_LINUX
show();
raise();
setWindowState( windowState() | Qt::WindowFullScreen );
show();
raise();
setWindowState( windowState() | Qt::WindowFullScreen );
#else
setWindowState( windowState() | Qt::WindowFullScreen );
show();
raise();
setWindowState( windowState() | Qt::WindowFullScreen );
show();
raise();
#endif
} else {
setWindowState( windowState() ^ Qt::WindowFullScreen );
show();
setWindowState( windowState() ^ Qt::WindowFullScreen );
show();
}
}

View File

@ -25,58 +25,40 @@
#include <QSet>
#include "retroshare/rsphoto.h"
#include "util/TokenQueue.h"
#include "PhotoCommentItem.h"
namespace Ui {
class PhotoDialog;
class PhotoDialog;
}
class PhotoDialog : public QDialog, public TokenResponse
{
Q_OBJECT
Q_OBJECT
public:
explicit PhotoDialog(RsPhoto* rs_photo, const RsPhotoPhoto& photo, QWidget *parent = 0);
~PhotoDialog();
explicit PhotoDialog(RsPhoto* rs_photo, const RsPhotoPhoto& photo, QWidget *parent = 0);
~PhotoDialog();
private slots:
void addComment();
void createComment();
void setFullScreen();
void toggleDetails();
void toggleComments();
public:
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
private:
void setUp();
void setUp();
/*!
* clears comments
* and places them back in dialog
*/
void resetComments();
void loadList(uint32_t token);
/*!
* Request comments
*/
void requestComments();
/*!
* Simply removes comments but doesn't place them back in dialog
*/
void clearComments();
void acknowledgeComment(uint32_t token);
void loadComment(uint32_t token);
void loadList(uint32_t token);
void addComment(const RsPhotoComment& comment);
private:
Ui::PhotoDialog *ui;
Ui::PhotoDialog *ui;
RsPhoto* mRsPhoto;
TokenQueue* mPhotoQueue;
RsPhotoPhoto mPhotoDetails;
QSet<PhotoCommentItem*> mComments;
RsPhoto* mRsPhoto;
TokenQueue* mPhotoQueue;
RsPhotoPhoto mPhotoDetails;
bool mCommentsCreated;
};
#endif // PHOTODIALOG_H

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>594</width>
<height>572</height>
<width>790</width>
<height>824</height>
</rect>
</property>
<property name="windowTitle">
@ -16,313 +16,239 @@
<property name="sizeGripEnabled">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="albumGroup">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="title">
<string>Photo</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_Photo">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>300</height>
</size>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="2" rowspan="2" colspan="2">
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QScrollArea" name="scrollArea">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>328</width>
<height>20</height>
</rect>
</property>
<widget class="QWidget" name="widget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="albumGroup">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Album / Photo Name</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="minimumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>558</width>
<height>551</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_Photo">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>300</height>
</size>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_2" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QToolButton" name="fullscreenButton">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/window_fullscreen.png</normaloff>:/images/window_fullscreen.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="detailsButton">
<property name="text">
<string>Details \/</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox">
<item>
<property name="text">
<string>50 %</string>
</property>
</item>
<item>
<property name="text">
<string>75 %</string>
</property>
</item>
<item>
<property name="text">
<string>100 %</string>
</property>
</item>
<item>
<property name="text">
<string>200 %</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QPushButton" name="commentsButton">
<property name="text">
<string>&lt;N&gt; Comments &gt;&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_details">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>1</number>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_Title">
<property name="enabled">
<bool>false</bool>
</property>
</layout>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Caption</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_Caption">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Where:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_Where">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEdit_When">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Photo Title:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>When</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="0">
<widget class="QLineEdit" name="lineEdit"/>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pushButton_AddComment">
<property name="text">
<string>Comment</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>Summary</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_Title">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Caption</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_Caption">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Where:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_Where">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEdit_When">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Photo Title:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>When</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QToolButton" name="fullscreenButton">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/window_fullscreen.png</normaloff>:/images/window_fullscreen.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>238</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="pushButton_AddCommentDlg">
<property name="text">
<string>Add Comment</string>
</property>
</item>
</layout>
</widget>
<widget class="QFrame" name="frame_comments">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</widget>
</item>
</layout>

View File

@ -165,7 +165,6 @@ void GxsGroupDialog::injectExtraWidget(QWidget *widget)
// add extra widget into layout.
QVBoxLayout *vbox = new QVBoxLayout();
vbox->addWidget(widget);
vbox->addStretch(1);
ui.extraFrame->setLayout(vbox);
}

View File

@ -1164,10 +1164,8 @@ gxsphotoshare {
gui/PhotoShare/PhotoShareItemHolder.h \
gui/PhotoShare/PhotoShare.h \
gui/PhotoShare/PhotoSlideShow.h \
gui/PhotoShare/PhotoDialog.h \
gui/PhotoShare/PhotoCommentItem.h \
gui/PhotoShare/AddCommentDialog.h
gui/PhotoShare/PhotoDialog.h
FORMS += \
gui/PhotoShare/AlbumExtra.ui \
gui/PhotoShare/PhotoItem.ui \
@ -1176,10 +1174,8 @@ gxsphotoshare {
gui/PhotoShare/AlbumDialog.ui \
gui/PhotoShare/AlbumCreateDialog.ui \
gui/PhotoShare/PhotoShare.ui \
gui/PhotoShare/PhotoSlideShow.ui \
gui/PhotoShare/PhotoCommentItem.ui \
gui/PhotoShare/AddCommentDialog.ui
gui/PhotoShare/PhotoSlideShow.ui
SOURCES += \
gui/PhotoShare/AlbumGroupDialog.cpp \
gui/PhotoShare/AlbumExtra.cpp \
@ -1191,10 +1187,8 @@ gxsphotoshare {
gui/PhotoShare/AlbumCreateDialog.cpp \
gui/PhotoShare/PhotoShareItemHolder.cpp \
gui/PhotoShare/PhotoShare.cpp \
gui/PhotoShare/PhotoSlideShow.cpp \
gui/PhotoShare/PhotoCommentItem.cpp \
gui/PhotoShare/AddCommentDialog.cpp
gui/PhotoShare/PhotoSlideShow.cpp
RESOURCES += gui/PhotoShare/Photo_images.qrc
}