about 70% done with PhotoDialog

- can add album (with thumbnail!)
- add photo (with photo!)
- can subscribe, but not added to ui yet

need to try some dummy msgs and bring up gxs_net





git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5549 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2012-09-13 22:58:42 +00:00
parent 088e7d61fc
commit 9f20c75f83
33 changed files with 1493 additions and 311 deletions

View File

@ -632,6 +632,9 @@ void RsGenExchange::publishGrps()
size = grp->metaData->serial_size();
char mData[size];
grp->metaData->mGroupId = grp->grpId;
// indicate user is admin through local subscribe flag
grp->metaData->mSubscribeFlags = GXS_SERV::GROUP_SUBSCRIBE_ADMIN;
ok = grp->metaData->serialise(mData, size);
grp->meta.setBinData(mData, size);

View File

@ -54,11 +54,11 @@ namespace GXS_SERV {
// Subscription Flags. (LOCAL)
static const uint32_t RSGXS_GROUP_SUBSCRIBE_ADMIN = 0x00000001;
static const uint32_t RSGXS_GROUP_SUBSCRIBE_PUBLISH = 0x00000002;
static const uint32_t RSGXS_GROUP_SUBSCRIBE_SUBSCRIBED = 0x00000004;
static const uint32_t RSGXS_GROUP_SUBSCRIBE_MONITOR = 0x00000008;
static const uint32_t RSGXS_GROUP_SUBSCRIBE_MASK = 0x0000000f;
static const uint32_t GROUP_SUBSCRIBE_ADMIN = 0x00000001;
static const uint32_t GROUP_SUBSCRIBE_PUBLISH = 0x00000002;
static const uint32_t GROUP_SUBSCRIBE_SUBSCRIBED = 0x00000004;
static const uint32_t GROUP_SUBSCRIBE_MONITOR = 0x00000008;
static const uint32_t GROUP_SUBSCRIBE_MASK = 0x0000000f;
}

View File

@ -98,7 +98,7 @@ void RsGxsNetService::syncWithPeers()
{
RsGxsGrpMetaData* meta = mit->second;
if(meta->mSubscribeFlags & GXS_SERV::RSGXS_GROUP_SUBSCRIBE_MASK)
if(meta->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_MASK)
grpIds.push_back(mit->first);
}

View File

@ -254,24 +254,29 @@ public:
/* details are updated in album - to choose Album ID, and storage path */
/*!
* This RsGenExchange service will be alerted to this album as \n
* a new album. Do not keep the submitted album as representative, wait for
* notification telling of successful submission
* @param album The album to be submitted
* @return false if submission failed
*/
virtual bool submitAlbumDetails(uint32_t& token, RsPhotoAlbum &album) = 0;
/*!
* 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
*/
virtual bool submitAlbumDetails(uint32_t& token, RsPhotoAlbum &album) = 0;
/*!
* This RsGenExchange service will be alerted to this photo as \n
* a new photo. Do not keep the submitted photo as representative, wait for new photo
* returned
* @param photo photo to submit
* @return
*/
virtual bool submitPhoto(uint32_t& token, RsPhotoPhoto &photo) = 0;
/*!
* 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
*/
virtual bool submitPhoto(uint32_t& token, RsPhotoPhoto &photo) = 0;
/*!
* 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
*/
virtual bool subscribeToAlbum(uint32_t& token, const RsGxsGroupId& grpId) = 0;
/*!
* This allows the client service to acknowledge that their msgs has
@ -282,6 +287,8 @@ public:
*/
virtual bool acknowledgeMsg(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId) = 0;
/*!
* This allows the client service to acknowledge that their grps has
* been created/modified and retrieve the create/modified grp ids

View File

@ -2295,6 +2295,10 @@ int RsServer::StartupRetroShare()
// start up gxs core server
createThread(*mGxsCore);
// create some dummy items
#endif
#ifdef ENABLE_GXS_SERVICES

View File

@ -1,5 +1,6 @@
#include "p3photoserviceV2.h"
#include "serialiser/rsphotov2items.h"
#include "gxs/rsgxsflags.h"
RsPhotoV2 *rsPhotoV2 = NULL;
@ -7,6 +8,7 @@ p3PhotoServiceV2::p3PhotoServiceV2(RsGeneralDataService* gds, RsNetworkExchangeS
: RsGenExchange(gds, nes, new RsGxsPhotoSerialiser(), RS_SERVICE_TYPE_PHOTO)
{
}
bool p3PhotoServiceV2::updated()
@ -146,6 +148,13 @@ bool p3PhotoServiceV2::submitAlbumDetails(uint32_t& token, RsPhotoAlbum& album)
return true;
}
bool p3PhotoServiceV2::subscribeToAlbum(uint32_t &token, const RsGxsGroupId &grpId)
{
RsGenExchange::setGroupSubscribeFlag(token, grpId, GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED);
return true;
}
void p3PhotoServiceV2::notifyChanges(std::vector<RsGxsNotify*>& changes)

View File

@ -39,7 +39,7 @@ public:
public:
/*!
* @return
* @return true if a change has occured
*/
bool updated();
@ -78,9 +78,30 @@ public:
/** 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 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);
/*!
* 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);
/*!
* This allows the client service to acknowledge that their msgs has
* been created/modified and retrieve the create/modified msg ids

View File

@ -27,7 +27,7 @@ RCC_DIR = temp/qrc
UI_DIR = temp/ui
MOC_DIR = temp/moc
#CONFIG += debug
CONFIG += debug
debug {
QMAKE_CFLAGS += -g
QMAKE_CXXFLAGS -= -O2
@ -108,45 +108,46 @@ win32-x-g++ {
#################################### Windows #####################################
win32 {
# Switch on extra warnings
QMAKE_CFLAGS += -Wextra
QMAKE_CXXFLAGS += -Wextra
# Switch off optimization for release version
QMAKE_CXXFLAGS_RELEASE -= -O2
QMAKE_CXXFLAGS_RELEASE += -O0
QMAKE_CFLAGS_RELEASE -= -O2
QMAKE_CFLAGS_RELEASE += -O0
# Switch on extra warnings
QMAKE_CFLAGS += -Wextra
QMAKE_CXXFLAGS += -Wextra
# Switch on optimization for debug version
#QMAKE_CXXFLAGS_DEBUG += -O2
#QMAKE_CFLAGS_DEBUG += -O2
# Switch off optimization for release version
QMAKE_CXXFLAGS_RELEASE -= -O2
QMAKE_CXXFLAGS_RELEASE += -O0
QMAKE_CFLAGS_RELEASE -= -O2
QMAKE_CFLAGS_RELEASE += -O0
OBJECTS_DIR = temp/obj
#LIBS += -L"D/Qt/2009.03/qt/plugins/imageformats"
#QTPLUGIN += qjpeg
# Switch on optimization for debug version
#QMAKE_CXXFLAGS_DEBUG += -O2
#QMAKE_CFLAGS_DEBUG += -O2
PRE_TARGETDEPS += ../../libretroshare/src/lib/libretroshare.a
# PRE_TARGETDEPS += ../../libretroshare/src/lib/libretroshare.a
PRE_TARGETDEPS += ../../libretroshare/libretroshare-build-desktop/lib/libretroshare.a
LIBS += ../../libretroshare/src/lib/libretroshare.a
LIBS += ../../openpgpsdk/src/lib/libops.a -lbz2
LIBS += -L"../../../lib"
LIBS += -lssl -lcrypto -lpthreadGC2d -lminiupnpc -lz
LIBS += ../../libretroshare/libretroshare-build-desktop/lib/libretroshare.a
LIBS += C:\Development\Rs\v0.5-gxs-b1\openpgpsdk\openpgpsdk-build-desktop\lib\libops.a
LIBS += C:\Development\Libraries\sqlite\sqlite-autoconf-3070900\lib\libsqlite3.a
LIBS += -L"../../../lib"
LIBS += -lssl -lcrypto -lgpgme -lpthreadGC2d -lminiupnpc -lz -lbz2
# added after bitdht
# LIBS += -lws2_32
LIBS += -luuid -lole32 -liphlpapi -lcrypt32-cygwin -lgdi32
LIBS += -lole32 -lwinmm
RC_FILE = gui/images/retroshare_win.rc
# LIBS += -lws2_32
LIBS += -luuid -lole32 -liphlpapi -lcrypt32-cygwin -lgdi32
LIBS += -lole32 -lwinmm
RC_FILE = gui/images/retroshare_win.rc
# export symbols for the plugins
LIBS += -Wl,--export-all-symbols,--out-implib,lib/libretroshare-gui.a
# export symbols for the plugins
#LIBS += -Wl,--export-all-symbols,--out-implib,lib/libretroshare-gui.a
GPG_ERROR_DIR = ../../../../libgpg-error-1.7
GPGME_DIR = ../../../../gpgme-1.1.8
GPG_ERROR_DIR = ../../../../lib/libgpg-error-1.7
GPGME_DIR = ../../../../lib/gpgme-1.1.8
INCLUDEPATH += . $${GPGME_DIR}/src $${GPG_ERROR_DIR}/src
# create lib directory
QMAKE_PRE_LINK = $(CHK_DIR_EXISTS) lib $(MKDIR) lib
DEFINES += WINDOWS_SYS
INCLUDEPATH += .
}
##################################### MacOS ######################################
@ -192,8 +193,8 @@ freebsd-* {
# ###########################################
bitdht {
LIBS += ../../libbitdht/src/lib/libbitdht.a
PRE_TARGETDEPS *= ../../libbitdht/src/lib/libbitdht.a
LIBS += ../../libbitdht/libbitdht-build-desktop/lib/libbitdht.a
PRE_TARGETDEPS *= ../../libbitdht/libbitdht-build-desktop/lib/libbitdht.a
}
win32 {
@ -414,6 +415,7 @@ HEADERS += rshare.h \
gui/GetStartedDialog.h
FORMS += gui/StartDialog.ui \
gui/GenCertDialog.ui \
gui/AboutDialog.ui \
@ -513,7 +515,7 @@ FORMS += gui/StartDialog.ui \
gui/style/StyleDialog.ui \
gui/dht/DhtWindow.ui \
gui/bwctrl/BwCtrlWindow.ui \
gui/GetStartedDialog.ui
gui/GetStartedDialog.ui \
SOURCES += main.cpp \
rshare.cpp \
@ -695,6 +697,7 @@ SOURCES += main.cpp \
gui/bwctrl/BwCtrlWindow.cpp \
gui/GetStartedDialog.cpp
RESOURCES += gui/images.qrc lang/lang.qrc gui/help/content/content.qrc
TRANSLATIONS += \
@ -854,28 +857,43 @@ SOURCES += gui/unfinished/ApplicationWindow.cpp \
photoshare {
HEADERS += gui/PhotoShare/PhotoItem.h \
gui/PhotoShare/PhotoDialog.h \
gui/PhotoShare/PhotoAddDialog.h \
gui/PhotoShare/PhotoDetailsDialog.h \
HEADERS += \
gui/PhotoShare/PhotoDialog.h \
gui/PhotoShare/PhotoDrop.h \
gui/PhotoShare/PhotoSlideShow.h \
util/TokenQueueV2.h \
util/TokenQueueV2.h \
gui/PhotoShare/AlbumDialog.h \
gui/PhotoShare/AlbumItem.h \
gui/PhotoShare/PhotoItem.h \
gui/PhotoShare/AlbumCreateDialog.h \
gui/PhotoShare/PhotoShareItemHolder.h \
gui/PhotoShare/PhotoShare.h
FORMS += gui/PhotoShare/PhotoItem.ui \
gui/PhotoShare/PhotoDialog.ui \
gui/PhotoShare/PhotoAddDialog.ui \
gui/PhotoShare/PhotoDetailsDialog.ui \
gui/PhotoShare/PhotoSlideShow.ui \
SOURCES += gui/PhotoShare/PhotoItem.cpp \
gui/PhotoShare/PhotoDialog.cpp \
gui/PhotoShare/PhotoAddDialog.cpp \
gui/PhotoShare/PhotoDetailsDialog.cpp \
#gui/PhotoShare/PhotoDetailsDialog.h \
# gui/PhotoShare/PhotoAddDialog.h \
FORMS += \
gui/PhotoShare/PhotoDialog.ui \
gui/PhotoShare/PhotoSlideShow.ui \
gui/PhotoShare/AlbumItem.ui \
gui/PhotoShare/AlbumDialog.ui \
gui/PhotoShare/PhotoItem.ui \
gui/PhotoShare/AlbumCreateDialog.ui \
gui/PhotoShare/PhotoShare.ui
# gui/PhotoShare/PhotoAddDialog.ui \1
# gui/PhotoShare/PhotoDetailsDialog.ui \
SOURCES += \
gui/PhotoShare/PhotoDialog.cpp \
gui/PhotoShare/PhotoDrop.cpp \
gui/PhotoShare/PhotoSlideShow.cpp \
util/TokenQueueV2.cpp \
gui/PhotoShare/AlbumDialog.cpp \
util/TokenQueueV2.cpp \
gui/PhotoShare/AlbumItem.cpp \
gui/PhotoShare/PhotoItem.cpp \
gui/PhotoShare/AlbumCreateDialog.cpp \
gui/PhotoShare/PhotoShareItemHolder.cpp \
gui/PhotoShare/PhotoShare.cpp
# gui/PhotoShare/PhotoAddDialog.cpp \
# gui/PhotoShare/PhotoDetailsDialog.cpp \
}
@ -922,7 +940,7 @@ identities {
FORMS += gui/Identity/IdDialog.ui \
gui/Identity/IdEditDialog.ui \
SOURCES += util/TokenQueue.cpp \
SOURCES += util/TokenQueue.cpp \
gui/Identity/IdDialog.cpp \
gui/Identity/IdEditDialog.cpp \

View File

@ -1,3 +1,5 @@
#include <QBuffer>
#include "AlbumCreateDialog.h"
#include "ui_AlbumCreateDialog.h"
@ -10,6 +12,7 @@ AlbumCreateDialog::AlbumCreateDialog(TokenQueueV2 *photoQueue, RsPhotoV2 *rs_pho
ui->setupUi(this);
connect(ui->publishButton, SIGNAL(clicked()), this, SLOT(publishAlbum()));
connect(ui->AlbumThumbNail, SIGNAL(clicked()), this, SLOT(addAlbumThumbnail()));
}
AlbumCreateDialog::~AlbumCreateDialog()
@ -27,6 +30,8 @@ void AlbumCreateDialog::publishAlbum()
album.mMeta.mGroupName = ui->lineEdit_Title_2->text().toStdString();
album.mDescription = ui->textEdit_Description->toPlainText().toStdString();
album.mWhere = ui->lineEdit_Where->text().toStdString();
album.mPhotographer = ui->lineEdit_Photographer->text().toStdString();
getAlbumThumbnail(album.mThumbnail);
uint32_t token;
mRsPhoto->submitAlbumDetails(token, album);
@ -34,6 +39,34 @@ void AlbumCreateDialog::publishAlbum()
close();
}
bool AlbumCreateDialog::getAlbumThumbnail(RsPhotoThumbnail &nail)
{
const QPixmap *tmppix = &mThumbNail;
QByteArray ba;
QBuffer buffer(&ba);
if(!tmppix->isNull())
{
// send chan image
buffer.open(QIODevice::WriteOnly);
tmppix->save(&buffer, "PNG"); // writes image into ba in PNG format
RsPhotoThumbnail tmpnail;
tmpnail.data = (uint8_t *) ba.data();
tmpnail.size = ba.size();
nail.copyFrom(tmpnail);
return true;
}
nail.data = NULL;
nail.size = 0;
return false;
}
void AlbumCreateDialog::addAlbumThumbnail()
{
QPixmap img = misc::getOpenThumbnailedPicture(this, tr("Load Album Thumbnail"), 64, 64);

View File

@ -22,6 +22,9 @@ private slots:
void publishAlbum();
void addAlbumThumbnail();
private:
bool getAlbumThumbnail(RsPhotoThumbnail &nail);
private:
Ui::AlbumCreateDialog *ui;

View File

@ -122,6 +122,13 @@ border-radius: 10px;
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
@ -166,6 +173,13 @@ border-radius: 10px;
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>

View File

@ -1,14 +1,90 @@
#include <QPixmap>
#include "AlbumDialog.h"
#include "ui_AlbumDialog.h"
AlbumDialog::AlbumDialog(QWidget *parent) :
AlbumDialog::AlbumDialog(const RsPhotoAlbum& album, TokenQueueV2* photoQueue, RsPhotoV2* rs_Photo, QWidget *parent) :
QWidget(parent),
ui(new Ui::AlbumDialog)
ui(new Ui::AlbumDialog), mPhotoQueue(photoQueue), mRsPhoto(rs_Photo), mAlbum(album), mPhotoSelected(NULL)
{
ui->setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true );
connect(ui->pushButton_PublishPhotos, SIGNAL(clicked()), this, SLOT(updateAlbumPhotos()));
connect(ui->pushButton_DeletePhoto, SIGNAL(clicked()), this, SLOT(deletePhoto()));
mPhotoDrop = ui->scrollAreaWidgetContents;
mPhotoDrop->setPhotoItemHolder(this);
setUp();
}
void AlbumDialog::setUp()
{
ui->lineEdit_Title->setText(QString::fromStdString(mAlbum.mMeta.mGroupName));
ui->lineEdit_Caption->setText(QString::fromStdString(mAlbum.mCaption));
ui->lineEdit_Category->setText(QString::fromStdString(mAlbum.mCategory));
ui->lineEdit_Identity->setText(QString::fromStdString(mAlbum.mMeta.mAuthorId));
QPixmap qtn;
qtn.loadFromData(mAlbum.mThumbnail.data, mAlbum.mThumbnail.size, mAlbum.mThumbnail.type.c_str());
ui->label_thumbNail->setPixmap(qtn);
}
void AlbumDialog::updateAlbumPhotos(){
QSet<PhotoItem*> photos;
mPhotoDrop->getPhotos(photos);
QSetIterator<PhotoItem*> sit(photos);
while(sit.hasNext())
{
PhotoItem* item = sit.next();
uint32_t token;
RsPhotoPhoto photo = item->getPhotoDetails();
photo.mMeta.mGroupId = mAlbum.mMeta.mGroupId;
mRsPhoto->submitPhoto(token, photo);
mPhotoQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
}
close();
}
void AlbumDialog::deletePhoto(){
if(mPhotoSelected)
{
mPhotoSelected->setSelected(false);
mPhotoDrop->deletePhoto(mPhotoSelected);
}
}
void AlbumDialog::editPhoto()
{
}
AlbumDialog::~AlbumDialog()
{
delete ui;
}
void AlbumDialog::notifySelection(PhotoShareItem *selection)
{
PhotoItem* pItem = dynamic_cast<PhotoItem*>(selection);
if(mPhotoSelected == NULL)
{
return;
}
else
{
mPhotoSelected->setSelected(false);
mPhotoSelected = pItem;
}
mPhotoSelected->setSelected(true);
}

View File

@ -2,21 +2,42 @@
#define ALBUMDIALOG_H
#include <QWidget>
#include "retroshare/rsphotoV2.h"
#include "util/TokenQueueV2.h"
#include "PhotoShareItemHolder.h"
#include "PhotoItem.h"
#include "PhotoDrop.h"
namespace Ui {
class AlbumDialog;
}
class AlbumDialog : public QWidget
class AlbumDialog : public QWidget, public PhotoShareItemHolder
{
Q_OBJECT
public:
explicit AlbumDialog(QWidget *parent = 0);
explicit AlbumDialog(const RsPhotoAlbum& album, TokenQueueV2* photoQueue, RsPhotoV2* rs_Photo, QWidget *parent = 0);
~AlbumDialog();
void notifySelection(PhotoShareItem* selection);
private:
void setUp();
private slots:
void updateAlbumPhotos();
void deletePhoto();
void editPhoto();
private:
Ui::AlbumDialog *ui;
RsPhotoV2* mRsPhoto;
TokenQueueV2* mPhotoQueue;
RsPhotoAlbum mAlbum;
PhotoDrop* mPhotoDrop;
PhotoItem* mPhotoSelected;
};
#endif // ALBUMDIALOG_H

View File

@ -1,21 +1,358 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author/>
<comment/>
<exportmacro/>
<class>AlbumDialog</class>
<widget class="QWidget" name="AlbumDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>649</width>
<height>436</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QWidget" name="layoutWidget_2">
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QGroupBox" name="albumGroup">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Album Thumbnail</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_thumbNail">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1" rowspan="2">
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>10</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</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_7">
<property name="text">
<string>Category:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Caption</string>
</property>
</widget>
</item>
<item row="2" 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="3" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Where:</string>
</property>
</widget>
</item>
<item row="3" 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="4" 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>Album Title:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>When</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_Category">
<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>
</layout>
</widget>
</item>
<item row="1" column="0">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>10</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Share Options</string>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_Visibility">
<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_11">
<property name="text">
<string>Comments</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Publish Identity</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_Identity">
<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_14">
<property name="text">
<string>Visibility</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_Comments">
<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>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget_3">
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,10">
<item>
<widget class="QLabel" name="label_10">
<property name="text">
<string>&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:400; 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; font-weight:600;&quot;&gt; Drag &amp;amp; Drop to insert pictures. Click on a picture to edit details below.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QScrollArea" name="scrollAreaPhotos">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>10</verstretch>
</sizepolicy>
</property>
<property name="acceptDrops">
<bool>true</bool>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
<widget class="PhotoDrop" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>627</width>
<height>116</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QWidget#scrollAreaWidgetContents{border: none;}</string>
</property>
<layout class="QGridLayout" name="gridLayout_2"/>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pushButton_DeletePhoto">
<property name="text">
<string>Delete Photo</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Edit Photo</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>68</width>
<height>17</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_PublishPhotos">
<property name="text">
<string>Publish Photos</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<pixmapfunction/>
<customwidgets>
<customwidget>
<class>PhotoDrop</class>
<extends>QWidget</extends>
<header>gui/PhotoShare/PhotoDrop.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -1,9 +1,12 @@
#include "AlbumItem.h"
#include "ui_AlbumItem.h"
#include <iostream>
AlbumItem::AlbumItem(const RsPhotoAlbum& album, QWidget *parent) :
QWidget(parent),
ui(new Ui::AlbumItem), mAlbum(album)
#include <QMouseEvent>
AlbumItem::AlbumItem(const RsPhotoAlbum &album, PhotoShareItemHolder *albumHolder, QWidget *parent) :
QWidget(NULL),
ui(new Ui::AlbumItem), mAlbum(album), mAlbumHolder(albumHolder)
{
ui->setupUi(this);
setUp();
@ -23,6 +26,35 @@ void AlbumItem::setUp()
ui->label_Thumbnail->setPixmap(qtn);
}
void AlbumItem::mousePressEvent(QMouseEvent *event)
{
QPoint pos = event->pos();
std::cerr << "AlbumItem::mousePressEvent(" << pos.x() << ", " << pos.y() << ")";
std::cerr << std::endl;
if(mAlbumHolder)
mAlbumHolder->notifySelection(this);
else
setSelected(true);
QWidget::mousePressEvent(event);
}
void AlbumItem::setSelected(bool on)
{
mSelected = on;
if (mSelected)
{
ui->albumFrame->setStyleSheet("QFrame#albumFrame{border: 2px solid #55CC55;\nbackground: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #55EE55, stop: 1 #CCCCCC);\nborder-radius: 10px}");
}
else
{
ui->albumFrame->setStyleSheet("QFrame#albumFrame{border: 2px solid #CCCCCC;\nbackground: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #EEEEEE, stop: 1 #CCCCCC);\nborder-radius: 10px}");
}
update();
}
RsPhotoAlbum AlbumItem::getAlbum()
{
return mAlbum;

View File

@ -4,26 +4,35 @@
#include <QWidget>
#include "string.h"
#include "retroshare/rsphotoV2.h"
#include "PhotoShareItemHolder.h"
namespace Ui {
class AlbumItem;
}
class AlbumItem : public QWidget
class AlbumItem : public QWidget, public PhotoShareItem
{
Q_OBJECT
public:
explicit AlbumItem(const RsPhotoAlbum& album, QWidget *parent = 0);
explicit AlbumItem(const RsPhotoAlbum& album, PhotoShareItemHolder* albumHolder, QWidget *parent = 0);
~AlbumItem();
RsPhotoAlbum getAlbum();
bool isSelected() { return mSelected ;}
void setSelected(bool selected);
protected:
void mousePressEvent(QMouseEvent *event);
private:
void setUp();
private:
Ui::AlbumItem *ui;
RsPhotoAlbum mAlbum;
PhotoShareItemHolder* mAlbumHolder;
bool mSelected;
};
#endif // ALBUMITEM_H

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>221</width>
<height>224</height>
<width>229</width>
<height>234</height>
</rect>
</property>
<property name="windowTitle">
@ -15,64 +15,85 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label_Thumbnail">
<property name="text">
<string>TextLabel</string>
<widget class="QFrame" name="albumFrame">
<property name="styleSheet">
<string notr="true">QFrame#albumFrame{border: 2px solid #CCCCCC;
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #EEEEEE, stop: 1 #CCCCCC);
border-radius: 10px}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QLabel" name="label_Thumbnail">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="AlbumTitle">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>&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:400; 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; font-weight:600;&quot;&gt;Album Title :&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>&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:400; 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; font-weight:600;&quot;&gt;Photographer :&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_AlbumTitle">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_Photographer">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="AlbumTitle">
<property name="text">
<string>&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:400; 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; font-weight:600;&quot;&gt;Album Title:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>&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:400; 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; font-weight:600;&quot;&gt;Photographer:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_AlbumTitle">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_Photographer">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>

View File

@ -25,6 +25,7 @@
#include <retroshare/rspeers.h>
#include <retroshare/rsphotoV2.h>
#include <gxs/rsgxsflags.h>
#include <iostream>
#include <sstream>
@ -34,6 +35,7 @@
#include "AlbumCreateDialog.h"
#include "AlbumItem.h"
#include "PhotoItem.h"
/******
* #define PHOTO_DEBUG 1
@ -58,7 +60,8 @@
* Will introduce a FullScreen SlideShow later... first get basics happening.
*/
#define IS_ALBUM_ADMIN(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN)
#define IS_ALBUM_SUBSCRIBED(subscribeFlags) (subscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED)
/** Constructor */
@ -70,11 +73,18 @@ PhotoDialog::PhotoDialog(QWidget *parent)
mAlbumSelected = NULL;
mPhotoSelected = NULL;
mSlideShow = NULL;
mAlbumDialog = NULL;
connect( ui.toolButton_NewAlbum, SIGNAL(clicked()), this, SLOT(OpenOrShowPhotoAddDialog()));
connect( ui.toolButton_ViewAlbum, SIGNAL(clicked()), this, SLOT(OpenPhotoEditDialog()));
connect( ui.toolButton_NewAlbum, SIGNAL(clicked()), this, SLOT(createAlbum()));
connect( ui.toolButton_ViewAlbum, SIGNAL(clicked()), this, SLOT(OpenAlbumDialog()));
connect( ui.toolButton_SlideShow, SIGNAL(clicked()), this, SLOT(OpenSlideShow()));
connect( ui.pushButton_YourAlbums, SIGNAL(clicked()), this, SLOT(updateAlbums()));
connect( ui.pushButton_SharedAlbums, SIGNAL(clicked()), this, SLOT(updateAlbums()));
connect( ui.pushButton_SubscribedAlbums, SIGNAL(clicked()), this, SLOT(updateAlbums()));
ui.pushButton_YourAlbums->setChecked(true); // default to your albums view
QTimer *timer = new QTimer(this);
timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
timer->start(1000);
@ -82,9 +92,73 @@ PhotoDialog::PhotoDialog(QWidget *parent)
/* setup TokenQueue */
mPhotoQueue = new TokenQueueV2(rsPhotoV2->getTokenService(), this);
requestAlbumData();
updateAlbums();
}
void PhotoDialog::notifySelection(PhotoShareItem *selection)
{
AlbumItem* aItem;
PhotoItem* pItem;
if((aItem = dynamic_cast<AlbumItem*>(selection)) != NULL)
{
if(mPhotoSelected)
mPhotoSelected->setSelected(false);
clearPhotos();
if(mAlbumSelected == aItem)
{
mAlbumSelected->setSelected(true);
}
else
{
if(mAlbumSelected == NULL)
{
mAlbumSelected = aItem;
}
else
{
mAlbumSelected->setSelected(false);
mAlbumSelected = aItem;
}
mAlbumSelected->setSelected(true);
}
updatePhotos();
}
else if((pItem = dynamic_cast<PhotoItem*>(selection)) != NULL)
{
if(mPhotoSelected == pItem)
{
mPhotoSelected->setSelected(true);
}
else
{
if(mPhotoSelected == NULL)
{
mPhotoSelected = pItem;
}
else
{
mPhotoSelected->setSelected(false);
mPhotoSelected = pItem;
}
mPhotoSelected->setSelected(true);
}
}
else
{
}
}
void PhotoDialog::checkUpdate()
@ -151,92 +225,176 @@ void PhotoDialog::createAlbum()
albumCreate.exec();
}
void PhotoDialog::OpenPhotoEditDialog()
void PhotoDialog::OpenAlbumDialog()
{
if(mAlbumSelected){
if(mAlbumDialog == NULL)
{
mAlbumDialog = new AlbumDialog(mAlbumSelected->getAlbum(), mPhotoQueue, rsPhotoV2);
connect(mAlbumDialog, SIGNAL(destroyed()), this, SLOT(SetDialogClosed()));
mAlbumDialog->show();
}else{
// bring dialog to front
mAlbumDialog->raise();
}
}
return;
}
void PhotoDialog::SetDialogClosed()
{
mAlbumDialog = NULL;
}
/*************** Edit Photo Dialog ***************/
bool PhotoDialog::matchesAlbumFilter(const RsPhotoAlbum &album)
{
return true;
}
double PhotoDialog::AlbumScore(const RsPhotoAlbum &album)
{
return 1;
}
bool PhotoDialog::matchesPhotoFilter(const RsPhotoPhoto &photo)
{
return true;
}
double PhotoDialog::PhotoScore(const RsPhotoPhoto &photo)
{
return 1;
}
void PhotoDialog::insertPhotosForSelectedAlbum()
{
std::cerr << "PhotoDialog::insertPhotosForSelectedAlbum()";
std::cerr << std::endl;
clearPhotos();
//std::list<std::string> albumIds;
if (mAlbumSelected)
{
std::string albumId = mAlbumSelected->getAlbum().mMeta.mGroupId;
//albumIds.push_back(albumId);
std::cerr << "PhotoDialog::insertPhotosForSelectedAlbum() AlbumId: " << albumId;
std::cerr << std::endl;
requestPhotoList(albumId);
}
//requestPhotoList(albumIds);
}
void PhotoDialog::clearAlbums()
{
std::cerr << "PhotoDialog::clearAlbums()" << std::endl;
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
QSetIterator<AlbumItem*> sit(mAlbumItems);
while(sit.hasNext())
{
AlbumItem* item = sit.next();
alayout->removeWidget(item);
item->setParent(NULL);
}
clearPhotos();
}
void PhotoDialog::clearPhotos()
{
std::cerr << "PhotoDialog::clearPhotos()" << std::endl;
std::cerr << "PhotoDialog::clearPhotos()" << std::endl;
mPhotoSelected = NULL;
QLayout *layout = ui.scrollAreaWidgetContents_2->layout();
mPhotoSelected = NULL;
if(mAlbumSelected)
{
const RsGxsGroupId& id = mAlbumSelected->getAlbum().mMeta.mGroupId;
QSetIterator<PhotoItem*> sit(mPhotoItems[id]);
while(sit.hasNext())
{
PhotoItem* item = sit.next();
layout->removeWidget(item);
item->setParent(NULL);
}
}
}
void PhotoDialog::updateAlbums()
{
clearAlbums();
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
QSetIterator<AlbumItem*> sit(mAlbumItems);
if(ui.pushButton_YourAlbums->isChecked())
{
ui.toolButton_subscribe->setEnabled(false);
ui.toolButton_NewAlbum->setEnabled(true);
ui.toolButton_SlideShow->setEnabled(true);
while(sit.hasNext()){
AlbumItem* item = sit.next();
uint32_t flags = item->getAlbum().mMeta.mSubscribeFlags;
if(IS_ALBUM_ADMIN(flags))
alayout->addWidget(item);
}
}else if(ui.pushButton_SubscribedAlbums->isChecked())
{
ui.toolButton_subscribe->setEnabled(false);
ui.toolButton_NewAlbum->setEnabled(false);
ui.toolButton_SlideShow->setEnabled(true);
while(sit.hasNext()){
AlbumItem* item = sit.next();
uint32_t flags = item->getAlbum().mMeta.mSubscribeFlags;
if(IS_ALBUM_SUBSCRIBED(flags))
alayout->addWidget(item);
}
}else if(ui.pushButton_SharedAlbums->isChecked())
{
ui.toolButton_subscribe->setEnabled(true);
ui.toolButton_NewAlbum->setEnabled(false);
ui.toolButton_SlideShow->setEnabled(false);
while(sit.hasNext()){
AlbumItem* item = sit.next();
uint32_t flags = item->getAlbum().mMeta.mSubscribeFlags;
if(flags == 0)
alayout->addWidget(item);
}
}
}
void PhotoDialog::addAlbum(const RsPhotoAlbum &album)
{
std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl;
std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl;
AlbumItem *item = new AlbumItem(album, this);
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
alayout->addWidget(item);
AlbumItem *item = new AlbumItem(album, this, this);
mAlbumItems.insert(item);
clearAlbums();
updateAlbums();
}
void PhotoDialog::addPhoto(const RsPhotoPhoto &photo)
{
std::cerr << "PhotoDialog::addPhoto() AlbumId: " << photo.mMeta.mGroupId;
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
std::cerr << std::endl;
std::cerr << "PhotoDialog::addPhoto() AlbumId: " << photo.mMeta.mGroupId;
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
std::cerr << std::endl;
PhotoItem* item = new PhotoItem(this, photo, this);
const RsGxsGroupId id = photo.mMeta.mGroupId;
mPhotoItems[id].insert(item);
}
void PhotoDialog::subscribeToAlbum()
{
if(mAlbumSelected){
RsGxsGroupId id = mAlbumSelected->getAlbum().mMeta.mGroupId;
uint32_t token;
rsPhotoV2->subscribeToAlbum(token, id);
mPhotoQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
}
}
void PhotoDialog::updatePhotos()
{
clearPhotos();
if(mAlbumSelected)
{
const RsGxsGroupId& grpId = mAlbumSelected->getAlbum().mMeta.mGroupId;
QSetIterator<PhotoItem*> sit(mPhotoItems[grpId]);
while(sit.hasNext())
{
QLayout *layout = ui.scrollAreaWidgetContents_2->layout();
layout->addWidget(sit.next());
}
}
}
/**************************** Request / Response Filling of Data ************************/
@ -280,7 +438,7 @@ void PhotoDialog::loadAlbumList(const uint32_t &token)
}
void PhotoDialog::requestAlbumData(std::list<std::string> &ids)
void PhotoDialog::requestAlbumData(std::list<RsGxsGroupId> &ids)
{
RsTokReqOptionsV2 opts;
uint32_t token;
@ -288,6 +446,13 @@ void PhotoDialog::requestAlbumData(std::list<std::string> &ids)
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, ids, 0);
}
void PhotoDialog::requestAlbumData()
{
RsTokReqOptionsV2 opts;
uint32_t token;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, 0);
}
bool PhotoDialog::loadAlbumData(const uint32_t &token)
{
@ -305,10 +470,9 @@ bool PhotoDialog::loadAlbumData(const uint32_t &token)
std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl;
AlbumItem *item = new AlbumItem(album, this);
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
alayout->addWidget(item);
addAlbum(album);
}
updateAlbums();
return true;
}
@ -407,6 +571,7 @@ void PhotoDialog::loadPhotoData(const uint32_t &token)
std::cerr << std::endl;
}
}
updatePhotos();
}

View File

@ -37,25 +37,37 @@
#include <map>
#include "util/TokenQueueV2.h"
#include "PhotoShareItemHolder.h"
class PhotoDialog : public MainPage, public TokenResponseV2
class PhotoDialog : public MainPage, public TokenResponseV2, public PhotoShareItemHolder
{
Q_OBJECT
public:
PhotoDialog(QWidget *parent = 0);
void notifySelection(PhotoShareItem* selection);
private slots:
void checkUpdate();
void createAlbum();
void OpenPhotoEditDialog();
void OpenAlbumDialog();
void OpenSlideShow();
void SetDialogClosed();
void updateAlbums();
void subscribeToAlbum();
private:
/* Request Response Functions for loading data */
void requestAlbumList(std::list<std::string>& ids);
void requestAlbumData(std::list<std::string> &ids);
void requestAlbumData(std::list<RsGxsGroupId> &ids);
/*!
* request data for all groups
*/
void requestAlbumData();
void requestPhotoList(GxsMsgReq &albumIds);
void requestPhotoList(const std::string &albumId);
void requestPhotoData(GxsMsgReq &photoIds);
@ -69,24 +81,15 @@ private:
void acknowledgeGroup(const uint32_t &token);
void acknowledgeMessage(const uint32_t &token);
/* TODO: These functions must be filled in for proper filtering to work
* and tied to the GUI input
*/
bool matchesAlbumFilter(const RsPhotoAlbum &album);
double AlbumScore(const RsPhotoAlbum &album);
bool matchesPhotoFilter(const RsPhotoPhoto &photo);
double PhotoScore(const RsPhotoPhoto &photo);
/* Grunt work of setting up the GUI */
void insertPhotosForSelectedAlbum();
void addAlbum(const RsPhotoAlbum &album);
void addPhoto(const RsPhotoPhoto &photo);
void addPhoto(const RsPhotoPhoto &photo);
void clearAlbums();
void clearPhotos();
void updatePhotos();
private:
@ -94,12 +97,16 @@ private:
AlbumItem* mAlbumSelected;
PhotoItem* mPhotoSelected;
PhotoSlideShow* mSlideShow;
AlbumDialog* mAlbumDialog;
TokenQueueV2 *mPhotoQueue;
/* UI - from Designer */
Ui::PhotoDialog ui;
QSet<AlbumItem*> mAlbumItems;
QMap<RsGxsGroupId, QSet<PhotoItem*> > mPhotoItems;
};
#endif

View File

@ -14,6 +14,67 @@
<string>Photo Share</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="sortGroup">
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="pushButton_YourAlbums">
<property name="text">
<string>Your Albums</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_SubscribedAlbums">
<property name="text">
<string>Subscribed Albums</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_SharedAlbums">
<property name="text">
<string>Shared Albums</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
@ -30,6 +91,13 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_subscribe">
<property name="text">
<string>Subscribe To Album</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_NewAlbum">
<property name="text">
@ -57,7 +125,7 @@
<x>0</x>
<y>0</y>
<width>754</width>
<height>277</height>
<height>261</height>
</rect>
</property>
<property name="styleSheet">
@ -100,7 +168,7 @@
<x>0</x>
<y>0</y>
<width>754</width>
<height>277</height>
<height>260</height>
</rect>
</property>
<property name="styleSheet">

View File

@ -57,7 +57,6 @@ PhotoDrop::PhotoDrop(QWidget *parent)
: QWidget(parent)
{
setAcceptDrops(true);
mIsSingleImageDrop = false;
mSelected = NULL;
checkMoveButtons();
@ -69,11 +68,6 @@ void PhotoDrop::clear()
{
}
void PhotoDrop::setSingleImage()
{
mIsSingleImageDrop = true;
}
PhotoItem *PhotoDrop::getSelectedPhotoItem()
{
@ -153,6 +147,10 @@ PhotoItem *PhotoDrop::getPhotoIdx(int idx)
return NULL;
}
void PhotoDrop::getPhotos(QSet<PhotoItem *> &photos)
{
photos = mPhotos;
}
void PhotoDrop::reorderPhotos()
@ -615,9 +613,8 @@ void PhotoDrop::dropEvent(QDropEvent *event)
std::cerr << "Whole URL: " << uit->toString().toStdString() << std::endl;
std::cerr << "or As Local File: " << localpath.toStdString() << std::endl;
//mPhotos.push_back(item);
//layout()->addWidget(item);
PhotoItem* item = new PhotoItem(mHolder, localpath);
addPhotoItem(item);
}
event->setDropAction(Qt::CopyAction);
event->accept();
@ -647,21 +644,30 @@ void PhotoDrop::mousePressEvent(QMouseEvent *event)
QWidget::mousePressEvent(event);
}
void PhotoDrop::setPhotoItemHolder(PhotoShareItemHolder *holder)
{
mHolder = holder;
}
void PhotoDrop::addPhotoItem(PhotoItem *item)
{
std::cerr << "PhotoDrop::addPhotoItem()";
std::cerr << std::endl;
if (mIsSingleImageDrop)
{
clearPhotos();
}
mPhotos.insert(item);
layout()->addWidget(item);
//checkMoveButtons();
}
bool PhotoDrop::deletePhoto(PhotoItem *item)
{
if(mPhotos.contains(item)){
mPhotos.remove(item);
layout()->removeWidget(item);
delete item;
}
else
return false;
}

View File

@ -28,6 +28,7 @@
#include <QPoint>
#include <QPixmap>
#include <QWidget>
#include <QSet>
QT_BEGIN_NAMESPACE
class QDragEnterEvent;
@ -36,6 +37,7 @@ class QMouseEvent;
QT_END_NAMESPACE
#include "gui/PhotoShare/PhotoItem.h"
#include "PhotoShareItemHolder.h"
#define PHOTO_SHIFT_NO_BUTTONS 0
#define PHOTO_SHIFT_LEFT_ONLY 1
@ -48,14 +50,23 @@ class PhotoDrop : public QWidget
Q_OBJECT
public:
PhotoDrop(QWidget *parent = 0);
void clear();
void setSingleImage();
PhotoItem *getSelectedPhotoItem();
int getPhotoCount();
PhotoItem *getPhotoIdx(int idx);
void getPhotos(QSet<PhotoItem*>& photos);
PhotoItem *getSelectedPhotoItem();
int getPhotoCount();
PhotoItem *getPhotoIdx(int idx);
void addPhotoItem(PhotoItem *item);
void addPhotoItem(PhotoItem *item);
void setPhotoItemHolder(PhotoShareItemHolder* holder);
/*!
* delete photo item held by photo drop
* @param item photo item to delete
* @return false if item could not be found
*/
bool deletePhoto(PhotoItem* item);
public slots:
void moveLeft();
@ -83,7 +94,8 @@ private:
PhotoItem *mSelected;
int mColumns;
bool mIsSingleImageDrop;
PhotoShareItemHolder* mHolder;
QSet<PhotoItem*> mPhotos;
};
#endif

View File

@ -1,14 +1,155 @@
#include <QMouseEvent>
#include <QBuffer>
#include <iostream>
#include <QLabel>
#include "PhotoItem.h"
#include "ui_PhotoItem.h"
PhotoItem::PhotoItem(QWidget *parent) :
PhotoItem::PhotoItem(PhotoShareItemHolder *holder, const RsPhotoPhoto &photo, QWidget *parent):
QWidget(parent),
ui(new Ui::PhotoItem)
ui(new Ui::PhotoItem), mHolder(holder), mPhotoDetails(photo)
{
ui->setupUi(this);
setSelected(false);
ui->lineEdit_PhotoGrapher->setEnabled(false);
ui->lineEdit_Title->setEnabled(false);
ui->editLayOut->removeWidget(ui->lineEdit_Title);
ui->editLayOut->removeWidget(ui->lineEdit_PhotoGrapher);
ui->lineEdit_Title->setVisible(false);
ui->lineEdit_PhotoGrapher->setVisible(false);
setUp();
}
PhotoItem::PhotoItem(PhotoShareItemHolder *holder, const QString& path, QWidget *parent) :
QWidget(parent),
ui(new Ui::PhotoItem), mHolder(holder)
{
ui->setupUi(this);
int width = 120;
int height = 120;
QPixmap qtn = QPixmap(path).scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
ui->label_Thumbnail->setPixmap(qtn);
mThumbNail = qtn;
setSelected(false);
getPhotoThumbnail(mPhotoDetails.mThumbnail);
connect(ui->lineEdit_Title, SIGNAL(editingFinished()), this, SLOT(setTitle()));
connect(ui->lineEdit_PhotoGrapher, SIGNAL(editingFinished()), this, SLOT(setPhotoGrapher()));
}
void PhotoItem::setSelected(bool selected)
{
mSelected = selected;
if (mSelected)
{
ui->photoFrame->setStyleSheet("QFrame#photoFrame{border: 2px solid #9562B8;\nbackground: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #55EE55, stop: 1 #CCCCCC);\nborder-radius: 10px}");
}
else
{
ui->photoFrame->setStyleSheet("QFrame#photoFrame{border: 2px solid #CCCCCC;\nbackground: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #EEEEEE, stop: 1 #CCCCCC);\nborder-radius: 10px}");
}
update();
}
bool PhotoItem::getPhotoThumbnail(RsPhotoThumbnail &nail)
{
const QPixmap *tmppix = &mThumbNail;
QByteArray ba;
QBuffer buffer(&ba);
if(!tmppix->isNull())
{
// send chan image
buffer.open(QIODevice::WriteOnly);
tmppix->save(&buffer, "PNG"); // writes image into ba in PNG format
RsPhotoThumbnail tmpnail;
tmpnail.data = (uint8_t *) ba.data();
tmpnail.size = ba.size();
nail.copyFrom(tmpnail);
return true;
}
nail.data = NULL;
nail.size = 0;
return false;
}
void PhotoItem::setTitle(){
mPhotoDetails.mMeta.mMsgName = ui->lineEdit_Title->text().toStdString();
}
void PhotoItem::setPhotoGrapher()
{
mPhotoDetails.mPhotographer = ui->lineEdit_PhotoGrapher->text().toStdString();
}
const RsPhotoPhoto& PhotoItem::getPhotoDetails()
{
return mPhotoDetails;
}
PhotoItem::~PhotoItem()
{
delete ui;
}
void PhotoItem::setUp()
{
mTitleLabel = new QLabel();
mPhotoGrapherLabel = new QLabel();
mTitleLabel->setText(QString::fromStdString(mPhotoDetails.mMeta.mMsgName));
mPhotoGrapherLabel->setText(QString::fromStdString(mPhotoDetails.mPhotographer));
ui->editLayOut->addWidget(mPhotoGrapherLabel);
ui->editLayOut->addWidget(mTitleLabel);
updateImage(mPhotoDetails.mThumbnail);
}
void PhotoItem::updateImage(const RsPhotoThumbnail &thumbnail)
{
if (thumbnail.data != NULL)
{
QPixmap qtn;
qtn.loadFromData(thumbnail.data, thumbnail.size, thumbnail.type.c_str());
ui->label_Thumbnail->setPixmap(qtn);
mThumbNail = qtn;
}
}
void PhotoItem::mousePressEvent(QMouseEvent *event)
{
QPoint pos = event->pos();
std::cerr << "PhotoItem::mousePressEvent(" << pos.x() << ", " << pos.y() << ")";
std::cerr << std::endl;
if(mHolder)
mHolder->notifySelection(this);
else
setSelected(true);
QWidget::mousePressEvent(event);
}

View File

@ -2,21 +2,51 @@
#define PHOTOITEM_H
#include <QWidget>
#include <QLabel>
#include "PhotoShareItemHolder.h"
#include "retroshare/rsphotoV2.h"
namespace Ui {
class PhotoItem;
}
class PhotoItem : public QWidget
class PhotoItem : public QWidget, public PhotoShareItem
{
Q_OBJECT
public:
explicit PhotoItem(QWidget *parent = 0);
PhotoItem(PhotoShareItemHolder *holder, const RsPhotoPhoto& photo, QWidget* parent = 0);
PhotoItem(PhotoShareItemHolder *holder, const QString& path, QWidget* parent = 0); // for new photos.
~PhotoItem();
void setSelected(bool selected);
bool isSelected(){ return mSelected; }
const RsPhotoPhoto& getPhotoDetails();
bool getPhotoThumbnail(RsPhotoThumbnail &nail);
protected:
void mousePressEvent(QMouseEvent *event);
private:
void updateImage(const RsPhotoThumbnail &thumbnail);
void setUp();
private slots:
void setTitle();
void setPhotoGrapher();
private:
Ui::PhotoItem *ui;
QPixmap mThumbNail;
QPixmap getPixmap() { return mThumbNail; }
bool mSelected;
RsPhotoPhoto mPhotoDetails;
PhotoShareItemHolder* mHolder;
QLabel *mTitleLabel, *mPhotoGrapherLabel;
};
#endif // PHOTOITEM_H

View File

@ -13,66 +13,90 @@
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_Thumbnail">
<property name="text">
<string>TextLabel</string>
<widget class="QFrame" name="photoFrame">
<property name="styleSheet">
<string notr="true">QFrame#photoFrame{border: 2px solid #CCCCCC;
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #EEEEEE, stop: 1 #CCCCCC);
border-radius: 10px}</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QLabel" name="label_Thumbnail">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="AlbumTitle">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>&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:400; 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; font-weight:600;&quot;&gt;Photo Title :&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>&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:400; 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; font-weight:600;&quot;&gt;Photographer :&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="editLayOut">
<item>
<widget class="QLineEdit" name="lineEdit_Title">
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>Enter Title Here</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_PhotoGrapher">
<property name="placeholderText">
<string>Enter Photographer</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="PhotoTitle">
<property name="text">
<string>&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:400; 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; font-weight:600;&quot;&gt;Photo Title:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>&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:400; 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; font-weight:600;&quot;&gt;Photographer:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_PhotoTitle">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_Photographer">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>

View File

@ -0,0 +1,14 @@
#include "PhotoShare.h"
#include "ui_PhotoShare.h"
PhotoShare::PhotoShare(QWidget *parent) :
QWidget(parent),
ui(new Ui::PhotoShare)
{
ui->setupUi(this);
}
PhotoShare::~PhotoShare()
{
delete ui;
}

View File

@ -0,0 +1,22 @@
#ifndef PHOTOSHARE_H
#define PHOTOSHARE_H
#include <QWidget>
namespace Ui {
class PhotoShare;
}
class PhotoShare : public QWidget
{
Q_OBJECT
public:
explicit PhotoShare(QWidget *parent = 0);
~PhotoShare();
private:
Ui::PhotoShare *ui;
};
#endif // PHOTOSHARE_H

View File

@ -0,0 +1,21 @@
<ui version="4.0">
<author/>
<comment/>
<exportmacro/>
<class>PhotoShare</class>
<widget class="QWidget" name="PhotoShare">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
</widget>
<pixmapfunction/>
<connections/>
</ui>

View File

@ -0,0 +1,5 @@
#include "PhotoShareItemHolder.h"
PhotoShareItemHolder::PhotoShareItemHolder()
{
}

View File

@ -0,0 +1,22 @@
#ifndef PHOTOSHAREITEMHOLDER_H
#define PHOTOSHAREITEMHOLDER_H
class PhotoShareItem
{
public:
PhotoShareItem() { return; }
virtual ~PhotoShareItem(){ return; }
virtual bool isSelected() = 0;
virtual void setSelected(bool selected) = 0;
};
class PhotoShareItemHolder
{
public:
PhotoShareItemHolder();
virtual void notifySelection(PhotoShareItem* selection) = 0;
};
#endif // PHOTOSHAREITEMHOLDER_H

View File

@ -23,7 +23,6 @@
#include "gui/TheWire/PulseAddDialog.h"
#include "gui/PhotoShare/PhotoDetailsDialog.h"
#include "gui/PhotoShare/PhotoDrop.h"
#include <iostream>

View File

@ -48,6 +48,15 @@ bool TokenQueueV2::requestGroupInfo(uint32_t &token, uint32_t anstype, const RsT
}
bool TokenQueueV2::requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts, uint32_t usertype)
{
uint32_t basictype = TOKENREQ_GROUPINFO;
mService->requestGroupInfo(token, anstype, opts);
queueRequest(token, basictype, anstype, usertype);
return true;
}
bool TokenQueueV2::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts, const GxsMsgReq& ids, uint32_t usertype)
{
uint32_t basictype = TOKENREQ_MSGINFO;
@ -58,6 +67,17 @@ bool TokenQueueV2::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTok
}
bool TokenQueueV2::requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts,
const std::list<RsGxsGroupId> &grpIds, uint32_t usertype)
{
uint32_t basictype = TOKENREQ_MSGINFO;
mService->requestMsgInfo(token, anstype, opts, grpIds);
queueRequest(token, basictype, anstype, usertype);
return true;
}
void TokenQueueV2::queueRequest(uint32_t token, uint32_t basictype, uint32_t anstype, uint32_t usertype)
{
std::cerr << "TokenQueueV2::queueRequest() Token: " << token << " Type: " << basictype;

View File

@ -63,6 +63,11 @@ class TokenResponseV2
};
/*!
*
*
*
*/
class TokenQueueV2: public QWidget
{
Q_OBJECT
@ -71,10 +76,23 @@ public:
TokenQueueV2(RsTokenServiceV2 *service, TokenResponseV2 *resp);
/* generic handling of token / response update behaviour */
/*!
*
* @token the token to be redeem is assigned here
*
*/
bool requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts,
std::list<RsGxsGroupId>& ids, uint32_t usertype);
bool requestGroupInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts, uint32_t usertype);
bool requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts,
const GxsMsgReq& ids, uint32_t usertype);
const std::list<RsGxsGroupId>& grpIds, uint32_t usertype);
bool requestMsgInfo(uint32_t &token, uint32_t anstype, const RsTokReqOptionsV2 &opts,
const GxsMsgReq& grpIds, uint32_t usertype);
bool cancelRequest(const uint32_t token);