diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.cpp b/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.cpp deleted file mode 100644 index 68c74e221..000000000 --- a/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/******************************************************************************* - * retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.cpp * - * * - * Copyright (C) 2018 by Retroshare Team * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ - -#include - -#include "AlbumCreateDialog.h" -#include "ui_AlbumCreateDialog.h" - -#include "util/misc.h" -#include "retroshare/rsgxsflags.h" - -AlbumCreateDialog::AlbumCreateDialog(TokenQueue *photoQueue, RsPhoto *rs_photo, QWidget *parent): - QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), - ui(new Ui::AlbumCreateDialog), mPhotoQueue(photoQueue), mRsPhoto(rs_photo), mPhotoSelected(NULL) -{ - ui->setupUi(this); - - ui->headerFrame->setHeaderImage(QPixmap(":/images/album_create_64.png")); - ui->headerFrame->setHeaderText(tr("Create Album")); - - -#if QT_VERSION >= 0x040700 - ui->lineEdit_Title_2->setPlaceholderText(tr("Untitle Album")); - ui->lineEdit_Caption_2->setPlaceholderText(tr("Say something about this album...")); - //ui->textEdit_Description->setPlaceholderText(tr("Say something about this album...")) ; - ui->lineEdit_Where->setPlaceholderText(tr("Where were these taken?")); -#endif - - ui->backButton->hide(); - - connect(ui->publishButton, SIGNAL(clicked()), this, SLOT(publishAlbum())); - connect(ui->AlbumThumbNail, SIGNAL(clicked()), this, SLOT(addAlbumThumbnail())); - - connect(ui->addphotosButton, SIGNAL(clicked()),this, SLOT(changePage())); - connect(ui->backButton, SIGNAL(clicked()),this, SLOT(backPage())); - - - mPhotoDrop = ui->scrollAreaWidgetContents; - mPhotoDrop->setPhotoItemHolder(this); - - -} - -AlbumCreateDialog::~AlbumCreateDialog() -{ - delete ui; -} - -#define PUBLIC_INDEX 0 -#define RESTRICTED_INDEX 1 -#define PRIVATE_INDEX 2 - -void AlbumCreateDialog::publishAlbum() -{ - // get fields for album to publish, publish and then exit dialog - RsPhotoAlbum album; - - album.mCaption = ui->lineEdit_Caption_2->text().toStdString(); - album.mPhotographer = ui->lineEdit_Photographer->text().toStdString(); - album.mMeta.mGroupName = ui->lineEdit_Title_2->text().toStdString(); - album.mDescription = ui->textEdit_Description->toPlainText().toStdString(); - album.mWhere = ui->lineEdit_Where->text().toStdString(); - album.mPhotographer = ui->lineEdit_Photographer->text().toStdString(); - getAlbumThumbnail(album.mThumbnail); - - - int currIndex = ui->privacyComboBox->currentIndex(); - - switch(currIndex) - { - case PUBLIC_INDEX: - album.mMeta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_PUBLIC; - break; - case RESTRICTED_INDEX: - album.mMeta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_RESTRICTED; - break; - case PRIVATE_INDEX: - album.mMeta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_PRIVATE; - break; - } - - uint32_t token; - mRsPhoto->submitAlbumDetails(token, album); - mPhotoQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, 0); - - publishPhotos(); - - close(); -} - -void AlbumCreateDialog::publishPhotos() -{ - // get fields for album to publish, publish and then exit dialog - RsPhotoAlbum album; - - QSet photos; - - mPhotoDrop->getPhotos(photos); - - QSetIterator sit(photos); - - while(sit.hasNext()) - { - PhotoItem* item = sit.next(); - uint32_t token; - RsPhotoPhoto photo = item->getPhotoDetails(); - photo.mMeta.mGroupId = album.mMeta.mGroupId; - mRsPhoto->submitPhoto(token, photo); - mPhotoQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0); - } - -} - -bool AlbumCreateDialog::getAlbumThumbnail(RsGxsImage &image) -{ - const QPixmap *tmppix = &mThumbNail; - - QByteArray ba; - QBuffer buffer(&ba); - - if(!tmppix->isNull()) - { - // send chan image - - buffer.open(QIODevice::WriteOnly); - tmppix->save(&buffer, "PNG"); // writes image into ba in PNG format - - image.copy((uint8_t *) ba.data(), ba.size()); - return true; - } - - image.clear(); - return false; -} - -void AlbumCreateDialog::addAlbumThumbnail() -{ - QPixmap img = misc::getOpenThumbnailedPicture(this, tr("Load Album Thumbnail"), 128, 128); - - if (img.isNull()) - return; - - mThumbNail = img; - - // to show the selected - ui->AlbumThumbNail->setIcon(mThumbNail); -} - -void AlbumCreateDialog::changePage() -{ - int nextPage = ui->stackedWidget->currentIndex() + 1; - if (nextPage >= ui->stackedWidget->count()) - nextPage = 0; - ui->stackedWidget->setCurrentIndex(nextPage); - - ui->backButton->show(); - ui->addphotosButton->hide(); -} - -void AlbumCreateDialog::backPage() -{ - int nextPage = ui->stackedWidget->currentIndex() - 1; - if (nextPage >= ui->stackedWidget->count()) - nextPage = 0; - ui->stackedWidget->setCurrentIndex(nextPage); - - ui->backButton->hide(); - ui->addphotosButton->show(); -} - -void AlbumCreateDialog::notifySelection(PhotoShareItem *selection) -{ - - PhotoItem* pItem = dynamic_cast(selection); - - if(mPhotoSelected == NULL) - { - return; - } - else - { - mPhotoSelected->setSelected(false); - mPhotoSelected = pItem; - } - - mPhotoSelected->setSelected(true); -} diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.h b/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.h deleted file mode 100644 index d136a374b..000000000 --- a/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.h +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.h * - * * - * Copyright (C) 2018 by Retroshare Team * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with this program. If not, see . * - * * - *******************************************************************************/ - -#ifndef ALBUMCREATEDIALOG_H -#define ALBUMCREATEDIALOG_H - -#include -#include "util/TokenQueue.h" -#include "retroshare/rsphoto.h" -#include "retroshare/rsphoto.h" -#include "PhotoShareItemHolder.h" -#include "PhotoItem.h" -#include "PhotoDrop.h" - -namespace Ui { - class AlbumCreateDialog; -} - - -class AlbumCreateDialog : public QDialog, public PhotoShareItemHolder -{ - Q_OBJECT - -public: - explicit AlbumCreateDialog(TokenQueue* photoQueue, RsPhoto* rs_photo, QWidget *parent = 0); - ~AlbumCreateDialog(); - - void notifySelection(PhotoShareItem* selection); - - -private slots: - void publishAlbum(); - void publishPhotos(); - void addAlbumThumbnail(); - void changePage(); - void backPage(); - - -private: - - bool getAlbumThumbnail(RsGxsImage &image); -private: - Ui::AlbumCreateDialog *ui; - - TokenQueue* mPhotoQueue; - RsPhoto* mRsPhoto; - QPixmap mThumbNail; - PhotoDrop* mPhotoDrop; - PhotoItem* mPhotoSelected; -}; - - - -#endif // ALBUMCREATEDIALOG_H diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.ui b/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.ui deleted file mode 100644 index af5729fc9..000000000 --- a/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.ui +++ /dev/null @@ -1,539 +0,0 @@ - - - AlbumCreateDialog - - - - 0 - 0 - 643 - 550 - - - - Create Album - - - true - - - - 0 - - - 0 - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - 0 - - - - - - - QFrame::NoFrame - - - - 0 - - - 6 - - - - - 3 - - - - - Album Name: - - - - - - - - - - - 64 - 64 - - - - - 64 - 64 - - - - -border: 2px solid white; -border-radius: 10px; - - - - - - - - :/images/album_64.png:/images/album_64.png - - - - 64 - 64 - - - - - - - - Category: - - - - - - - - Animals - - - - - Family - - - - - Friends - - - - - Flowers - - - - - Holiday - - - - - Landscapes - - - - - Pets - - - - - Portraits - - - - - Travel - - - - - Work - - - - - Random - - - - - - - - Caption: - - - - - - - - - - Where: - - - - - - - - - - Photographer: - - - - - - - - - - Description: - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Horizontal - - - - - - - - - Qt::Horizontal - - - - - - - - 1 - 0 - - - - Share Options - - - - - - - - Policy: - - - - - - - Quality: - - - - - - - Comments: - - - - - - - Identity: - - - - - - - - - - - - 0 - 0 - - - - - Public - - - - - Restricted - - - - - - - - - 0 - 0 - - - - - Resize Images (< 1Mb) - - - - - Resize Images (< 10Mb) - - - - - Send Original Images - - - - - - - - - 0 - 0 - - - - - No Comments Allowed - - - - - Authenticated Comments - - - - - Any Comments Allowed - - - - - - - - - 0 - 0 - - - - - Publish with Identity - - - - - - - - - - Qt::Horizontal - - - - 168 - 20 - - - - - - - - - - - - - - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; font-weight:600;"> Drag &amp; Drop to insert pictures. Click on a picture to edit details below.</span></p></body></html> - - - - - - - - 0 - 10 - - - - true - - - Qt::ScrollBarAsNeeded - - - true - - - Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft - - - - - 0 - 0 - 621 - 458 - - - - QWidget#scrollAreaWidgetContents{border: none;} - - - - - - - - - - - - - - - - 9 - - - - - Qt::Horizontal - - - - 419 - 18 - - - - - - - - QDialogButtonBox::Cancel - - - - - - - Back - - - - - - - Add Photos - - - - - - - Publish Album - - - - - - - - - - - HeaderFrame - QFrame -
gui/common/HeaderFrame.h
- 1 -
- - PhotoDrop - QWidget -
gui/PhotoShare/PhotoDrop.h
- 1 -
-
- - - - - - - buttonBox - rejected() - AlbumCreateDialog - close() - - - 353 - 529 - - - 321 - 274 - - - - -
diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumGroupDialog.cpp b/retroshare-gui/src/gui/PhotoShare/AlbumGroupDialog.cpp index 33e6cc229..b4bd3634f 100644 --- a/retroshare-gui/src/gui/PhotoShare/AlbumGroupDialog.cpp +++ b/retroshare-gui/src/gui/PhotoShare/AlbumGroupDialog.cpp @@ -37,21 +37,26 @@ const uint32_t AlbumCreateEnabledFlags = ( GXS_GROUP_FLAGS_EXTRA | 0); +// Album Requirements: +// - All Photos require Publish signature (PUBLISH THREADS). +// - Comments are in the threads - so these need Author signatures. +// - Author signature required for all groups. uint32_t AlbumCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC | //GXS_GROUP_DEFAULTS_DISTRIB_GROUP | //GXS_GROUP_DEFAULTS_DISTRIB_LOCAL | - GXS_GROUP_DEFAULTS_PUBLISH_OPEN | - //GXS_GROUP_DEFAULTS_PUBLISH_THREADS | + //GXS_GROUP_DEFAULTS_PUBLISH_OPEN | + GXS_GROUP_DEFAULTS_PUBLISH_THREADS | //GXS_GROUP_DEFAULTS_PUBLISH_REQUIRED | //GXS_GROUP_DEFAULTS_PUBLISH_ENCRYPTED | //GXS_GROUP_DEFAULTS_PERSONAL_GPG | - GXS_GROUP_DEFAULTS_PERSONAL_REQUIRED | - //GXS_GROUP_DEFAULTS_PERSONAL_IFNOPUB | + //GXS_GROUP_DEFAULTS_PERSONAL_REQUIRED | + GXS_GROUP_DEFAULTS_PERSONAL_IFNOPUB | + GXS_GROUP_DEFAULTS_PERSONAL_GROUP | - //GXS_GROUP_DEFAULTS_COMMENTS_YES | - GXS_GROUP_DEFAULTS_COMMENTS_NO | + GXS_GROUP_DEFAULTS_COMMENTS_YES | + //GXS_GROUP_DEFAULTS_COMMENTS_NO | 0); uint32_t AlbumEditEnabledFlags = AlbumCreateEnabledFlags; diff --git a/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp index d5880dd90..ef0099faa 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp @@ -585,11 +585,11 @@ void GxsGroupDialog::editGroup() RsGroupMetaData newMeta; newMeta.mGroupId = mGrpMeta.mGroupId; - - if(!prepareGroupMetaData(newMeta)) + QString reason; + if(!prepareGroupMetaData(newMeta, reason)) { /* error message */ - QMessageBox::warning(this, "RetroShare", tr("Failed to Prepare Group MetaData - please Review"), QMessageBox::Ok, QMessageBox::Ok); + QMessageBox::warning(this, "RetroShare", tr("Failed to Prepare Group MetaData: ") + reason, QMessageBox::Ok, QMessageBox::Ok); return; //Don't add a empty name!! } @@ -612,14 +612,22 @@ void GxsGroupDialog::editGroup() close(); } -bool GxsGroupDialog::prepareGroupMetaData(RsGroupMetaData &meta) +bool GxsGroupDialog::prepareGroupMetaData(RsGroupMetaData &meta, QString &reason) { std::cerr << "GxsGroupDialog::prepareGroupMetaData()"; std::cerr << std::endl; // here would be the place to check for empty author id // but GXS_SERV::GRP_OPTION_AUTHEN_AUTHOR_SIGN is currently not used by any service + ui.idChooser->getChosenId(meta.mAuthorId); + if ((mDefaultsFlags & GXS_GROUP_DEFAULTS_PERSONAL_GROUP) && (meta.mAuthorId.isNull())) { + std::cerr << "GxsGroupDialog::prepareGroupMetaData()"; + std::cerr << " Group needs a Personal Signature"; + std::cerr << std::endl; + reason = "Missing AuthorId"; + return false; + } QString name = getName(); uint32_t flags = GXS_SERV::FLAG_PRIVACY_PUBLIC; @@ -628,6 +636,7 @@ bool GxsGroupDialog::prepareGroupMetaData(RsGroupMetaData &meta) std::cerr << "GxsGroupDialog::prepareGroupMetaData()"; std::cerr << " Invalid GroupName"; std::cerr << std::endl; + reason = "Missing GroupName"; return false; } @@ -641,6 +650,7 @@ bool GxsGroupDialog::prepareGroupMetaData(RsGroupMetaData &meta) std::cerr << "GxsGroupDialog::prepareGroupMetaData()"; std::cerr << " Invalid Circles"; std::cerr << std::endl; + reason = "Invalid Circle Parameters"; return false; } @@ -668,10 +678,11 @@ void GxsGroupDialog::createGroup() uint32_t token; RsGroupMetaData meta; - if (!prepareGroupMetaData(meta)) + QString reason; + if (!prepareGroupMetaData(meta, reason)) { /* error message */ - QMessageBox::warning(this, "RetroShare", tr("Failed to Prepare Group MetaData - please Review"), QMessageBox::Ok, QMessageBox::Ok); + QMessageBox::warning(this, "RetroShare", tr("Failed to Prepare Group MetaData: ") + reason, QMessageBox::Ok, QMessageBox::Ok); return; //Don't add with invalid circle. } diff --git a/retroshare-gui/src/gui/gxs/GxsGroupDialog.h b/retroshare-gui/src/gui/gxs/GxsGroupDialog.h index 709ad4d6f..49225dd1d 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupDialog.h +++ b/retroshare-gui/src/gui/gxs/GxsGroupDialog.h @@ -84,10 +84,13 @@ public: #define GXS_GROUP_DEFAULTS_PERSONAL_PGP 0x00000100 #define GXS_GROUP_DEFAULTS_PERSONAL_REQUIRED 0x00000200 #define GXS_GROUP_DEFAULTS_PERSONAL_IFNOPUB 0x00000400 +// independent from other PERSONAL FLAGS. If Group requires a AuthorId. +#define GXS_GROUP_DEFAULTS_PERSONAL_GROUP 0x00000800 #define GXS_GROUP_DEFAULTS_COMMENTS_YES 0x00001000 #define GXS_GROUP_DEFAULTS_COMMENTS_NO 0x00002000 + #define GXS_GROUP_DEFAULTS_ANTISPAM_FAVOR_PGP 0x00100000 #define GXS_GROUP_DEFAULTS_ANTISPAM_TRACK 0x00200000 #define GXS_GROUP_DEFAULTS_ANTISPAM_FAVOR_PGP_KNOWN 0x00400000 @@ -271,7 +274,7 @@ private: void loadGroup(uint32_t token); void updateFromExistingMeta(const QString &description); - bool prepareGroupMetaData(RsGroupMetaData &meta); + bool prepareGroupMetaData(RsGroupMetaData &meta, QString &reason); std::list mShareList; QPixmap mPicture; diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro index 01bb92012..8806741ee 100644 --- a/retroshare-gui/src/retroshare-gui.pro +++ b/retroshare-gui/src/retroshare-gui.pro @@ -1159,7 +1159,6 @@ gxsphotoshare { gui/PhotoShare/PhotoDrop.h \ gui/PhotoShare/AlbumItem.h \ gui/PhotoShare/AlbumDialog.h \ - gui/PhotoShare/AlbumCreateDialog.h \ gui/PhotoShare/PhotoItem.h \ gui/PhotoShare/PhotoShareItemHolder.h \ gui/PhotoShare/PhotoShare.h \ @@ -1172,7 +1171,6 @@ gxsphotoshare { gui/PhotoShare/PhotoDialog.ui \ gui/PhotoShare/AlbumItem.ui \ gui/PhotoShare/AlbumDialog.ui \ - gui/PhotoShare/AlbumCreateDialog.ui \ gui/PhotoShare/PhotoShare.ui \ gui/PhotoShare/PhotoSlideShow.ui @@ -1184,7 +1182,6 @@ gxsphotoshare { gui/PhotoShare/PhotoDrop.cpp \ gui/PhotoShare/AlbumItem.cpp \ gui/PhotoShare/AlbumDialog.cpp \ - gui/PhotoShare/AlbumCreateDialog.cpp \ gui/PhotoShare/PhotoShareItemHolder.cpp \ gui/PhotoShare/PhotoShare.cpp \ gui/PhotoShare/PhotoSlideShow.cpp