diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.ui b/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.ui index 52e3c5d70..5c881bfb9 100644 --- a/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.ui +++ b/retroshare-gui/src/gui/PhotoShare/AlbumCreateDialog.ui @@ -7,11 +7,14 @@ 0 0 465 - 347 + 356 - Dialog + Create Album + + + true diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumDialog.cpp b/retroshare-gui/src/gui/PhotoShare/AlbumDialog.cpp index c2500df2d..c39825bdf 100644 --- a/retroshare-gui/src/gui/PhotoShare/AlbumDialog.cpp +++ b/retroshare-gui/src/gui/PhotoShare/AlbumDialog.cpp @@ -4,11 +4,10 @@ #include "ui_AlbumDialog.h" AlbumDialog::AlbumDialog(const RsPhotoAlbum& album, TokenQueue* photoQueue, RsPhotoV2* rs_Photo, QWidget *parent) : - QWidget(parent), - ui(new Ui::AlbumDialog), mPhotoQueue(photoQueue), mRsPhoto(rs_Photo), mAlbum(album), mPhotoSelected(NULL) + QDialog(parent), + ui(new Ui::AlbumDialog), mRsPhoto(rs_Photo), mPhotoQueue(photoQueue), 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())); diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumDialog.h b/retroshare-gui/src/gui/PhotoShare/AlbumDialog.h index 0827a787e..8ee8b0405 100644 --- a/retroshare-gui/src/gui/PhotoShare/AlbumDialog.h +++ b/retroshare-gui/src/gui/PhotoShare/AlbumDialog.h @@ -1,7 +1,7 @@ #ifndef ALBUMDIALOG_H #define ALBUMDIALOG_H -#include +#include #include "retroshare/rsphotoV2.h" #include "util/TokenQueue.h" #include "PhotoShareItemHolder.h" @@ -12,7 +12,7 @@ namespace Ui { class AlbumDialog; } -class AlbumDialog : public QWidget, public PhotoShareItemHolder +class AlbumDialog : public QDialog, public PhotoShareItemHolder { Q_OBJECT diff --git a/retroshare-gui/src/gui/PhotoShare/AlbumDialog.ui b/retroshare-gui/src/gui/PhotoShare/AlbumDialog.ui index a7f38e867..b5568d690 100644 --- a/retroshare-gui/src/gui/PhotoShare/AlbumDialog.ui +++ b/retroshare-gui/src/gui/PhotoShare/AlbumDialog.ui @@ -1,7 +1,7 @@ AlbumDialog - + 0 @@ -11,7 +11,14 @@ - Form + Album + + + + :/images/rstray3.png:/images/rstray3.png + + + true @@ -278,7 +285,7 @@ p, li { white-space: pre-wrap; } 0 0 627 - 116 + 107 @@ -353,6 +360,8 @@ p, li { white-space: pre-wrap; } 1 - + + + diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoCommentItem.cpp b/retroshare-gui/src/gui/PhotoShare/PhotoCommentItem.cpp index 6cfb2236a..8d757122e 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoCommentItem.cpp +++ b/retroshare-gui/src/gui/PhotoShare/PhotoCommentItem.cpp @@ -24,7 +24,7 @@ const RsPhotoComment& PhotoCommentItem::getComment() void PhotoCommentItem::setUp() { - ui->labelComment->setText(QString::fromStdString(mComment.mComment)); + 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"); diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoDialog.cpp b/retroshare-gui/src/gui/PhotoShare/PhotoDialog.cpp index 9379a7f63..80348d1d4 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoDialog.cpp +++ b/retroshare-gui/src/gui/PhotoShare/PhotoDialog.cpp @@ -3,19 +3,20 @@ #include "PhotoDialog.h" #include "ui_PhotoDialog.h" - +#include "AddCommentDialog.h" PhotoDialog::PhotoDialog(RsPhotoV2 *rs_photo, const RsPhotoPhoto &photo, QWidget *parent) : QDialog(parent), ui(new Ui::PhotoDialog), mRsPhoto(rs_photo), mPhotoQueue(new TokenQueue(mRsPhoto->getTokenService(), this)), - mPhotoDetails(photo), mCommentDialog(NULL) - + mPhotoDetails(photo) { ui->setupUi(this); setAttribute ( Qt::WA_DeleteOnClose, true ); - connect(ui->toolButton_AddComment, SIGNAL(clicked()), this, SLOT(createComment())); - setUp(); + connect(ui->pushButton_AddComment, SIGNAL(clicked()), this, SLOT(createComment())); + connect(ui->pushButton_AddCommentDlg, SIGNAL(clicked()), this, SLOT(addComment())); + + setUp(); } PhotoDialog::~PhotoDialog() @@ -36,15 +37,19 @@ void PhotoDialog::setUp() requestComments(); } - - - void PhotoDialog::addComment() { - mCommentDialog = new AddCommentDialog(this); - connect(mCommentDialog, SIGNAL(accepted()), this, SLOT(createComment())); - connect(mCommentDialog, SIGNAL(rejected()), mCommentDialog, SLOT(deleteLater())); - mCommentDialog->exec(); + 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); + } } void PhotoDialog::clearComments() @@ -90,18 +95,18 @@ void PhotoDialog::requestComments() void PhotoDialog::createComment() { - RsPhotoComment comment; - QString commentString = ui->lineEdit->text(); + RsPhotoComment comment; + QString commentString = ui->lineEdit->text(); - comment.mComment = commentString.toStdString(); + 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(); + 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(); } diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoDialog.h b/retroshare-gui/src/gui/PhotoShare/PhotoDialog.h index 855e14f3f..867382fbc 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoDialog.h +++ b/retroshare-gui/src/gui/PhotoShare/PhotoDialog.h @@ -6,7 +6,6 @@ #include "retroshare/rsphotoV2.h" #include "util/TokenQueue.h" #include "PhotoCommentItem.h" -#include "AddCommentDialog.h" namespace Ui { class PhotoDialog; @@ -57,8 +56,6 @@ private: TokenQueue* mPhotoQueue; RsPhotoPhoto mPhotoDetails; QSet mComments; - AddCommentDialog* mCommentDialog; - }; #endif // PHOTODIALOG_H diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoDialog.ui b/retroshare-gui/src/gui/PhotoShare/PhotoDialog.ui index 3436b84a0..5cf9d47a5 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoDialog.ui +++ b/retroshare-gui/src/gui/PhotoShare/PhotoDialog.ui @@ -10,15 +10,16 @@ 566 - - - 0 - 0 - - PhotoShare + + + :/images/rstray3.png:/images/rstray3.png + + + true + @@ -54,7 +55,7 @@ - + @@ -76,7 +77,7 @@ 0 0 - 325 + 369 18 @@ -194,8 +195,15 @@ + + + + Add Comment + + + - + Comment @@ -203,6 +211,8 @@ - + + + diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoShare.cpp b/retroshare-gui/src/gui/PhotoShare/PhotoShare.cpp index 4f1fdf342..010990d4b 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoShare.cpp +++ b/retroshare-gui/src/gui/PhotoShare/PhotoShare.cpp @@ -75,9 +75,6 @@ PhotoShare::PhotoShare(QWidget *parent) mAlbumSelected = NULL; mPhotoSelected = NULL; - mSlideShow = NULL; - mAlbumDialog = NULL; - mPhotoDialog = NULL; connect( ui.toolButton_NewAlbum, SIGNAL(clicked()), this, SLOT(createAlbum())); connect( ui.toolButton_ViewAlbum, SIGNAL(clicked()), this, SLOT(OpenAlbumDialog())); @@ -198,28 +195,18 @@ void PhotoShare::checkUpdate() void PhotoShare::OpenSlideShow() { + // TODO. + if (!mAlbumSelected) { + // ALERT. + int ret = QMessageBox::information(this, tr("PhotoShare"), + tr("Please select an album before\n" + "requesting to edit it!"), + QMessageBox::Ok); + return; + } - // TODO. - if (!mAlbumSelected) - { - // ALERT. - int ret = QMessageBox::information(this, tr("PhotoShare"), - tr("Please select an album before\n" - "requesting to edit it!"), - QMessageBox::Ok); - return; - } - - if (mSlideShow) - { - mSlideShow->show(); - } - else - { - mSlideShow = new PhotoSlideShow(mAlbumSelected->getAlbum(), NULL); - mSlideShow->show(); - } - + PhotoSlideShow *dlg = new PhotoSlideShow(mAlbumSelected->getAlbum(), NULL); + dlg->show(); } @@ -233,48 +220,20 @@ void PhotoShare::createAlbum() void PhotoShare::OpenAlbumDialog() { - if(mAlbumSelected){ - - if(mAlbumDialog == NULL) - { - mAlbumDialog = new AlbumDialog(mAlbumSelected->getAlbum(), mPhotoQueue, rsPhotoV2); - connect(mAlbumDialog, SIGNAL(destroyed()), this, SLOT(SetAlbumDialogClosed())); - mAlbumDialog->show(); - }else{ - // bring dialog to front - mAlbumDialog->raise(); - } + if (mAlbumSelected) { + AlbumDialog dlg(mAlbumSelected->getAlbum(), mPhotoQueue, rsPhotoV2); + dlg.exec(); } - return; } void PhotoShare::OpenPhotoDialog() { - if(mPhotoSelected) - { - if(mPhotoDialog == NULL) - { - mPhotoDialog = new PhotoDialog(rsPhotoV2, mPhotoSelected->getPhotoDetails()); - connect(mPhotoDialog, SIGNAL(destroyed()), this, SLOT(SetPhotoDialogClosed())); - mPhotoDialog->show(); - } - else - { - mPhotoDialog->raise(); - } + if (mPhotoSelected) { + PhotoDialog *dlg = new PhotoDialog(rsPhotoV2, mPhotoSelected->getPhotoDetails()); + dlg->show(); } } -void PhotoShare::SetAlbumDialogClosed() -{ - mAlbumDialog = NULL; -} - -void PhotoShare::SetPhotoDialogClosed() -{ - mPhotoDialog = NULL; -} - /*************** Edit Photo Dialog ***************/ void PhotoShare::clearAlbums() diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoShare.h b/retroshare-gui/src/gui/PhotoShare/PhotoShare.h index b936de318..53b722bd1 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoShare.h +++ b/retroshare-gui/src/gui/PhotoShare/PhotoShare.h @@ -33,19 +33,16 @@ public: void notifySelection(PhotoShareItem* selection); private slots: - void checkUpdate(); void createAlbum(); void OpenAlbumDialog(); void OpenPhotoDialog(); void OpenSlideShow(); - void SetAlbumDialogClosed(); - void SetPhotoDialogClosed(); void updateAlbums(); void subscribeToAlbum(); void deleteAlbum(const RsGxsGroupId&); -private: +private: /* Request Response Functions for loading data */ void requestAlbumList(std::list& ids); void requestAlbumData(std::list &ids); @@ -83,13 +80,9 @@ private: void updatePhotos(); private: - - AlbumItem* mAlbumSelected; PhotoItem* mPhotoSelected; - PhotoSlideShow* mSlideShow; - AlbumDialog* mAlbumDialog; - PhotoDialog* mPhotoDialog; + TokenQueue *mPhotoQueue; diff --git a/retroshare-gui/src/gui/PhotoShare/PhotoSlideShow.ui b/retroshare-gui/src/gui/PhotoShare/PhotoSlideShow.ui index 9bc91f506..a684f9a48 100644 --- a/retroshare-gui/src/gui/PhotoShare/PhotoSlideShow.ui +++ b/retroshare-gui/src/gui/PhotoShare/PhotoSlideShow.ui @@ -10,9 +10,6 @@ 671 - - - @@ -137,8 +134,6 @@ - - - + diff --git a/retroshare-gui/src/gui/Posted/PostedDialog.ui b/retroshare-gui/src/gui/Posted/PostedDialog.ui index bf21aa5f6..fef6921dd 100644 --- a/retroshare-gui/src/gui/Posted/PostedDialog.ui +++ b/retroshare-gui/src/gui/Posted/PostedDialog.ui @@ -10,24 +10,16 @@ 557 - - - -1 - - true - - - - + diff --git a/retroshare-gui/src/gui/unfinished/ApplicationWindow.ui b/retroshare-gui/src/gui/unfinished/ApplicationWindow.ui index 384af0024..21e91fe63 100644 --- a/retroshare-gui/src/gui/unfinished/ApplicationWindow.ui +++ b/retroshare-gui/src/gui/unfinished/ApplicationWindow.ui @@ -47,7 +47,7 @@ - Qt::NoContextMenu + Qt::CustomContextMenu true