Added minimize/maximize buttons to QDialog,

Added to display "Where" and "Description" Label on Album Dialog
Added a StackedWidget to Create Album Dialog, to use later for adding Photos, when generating a new Album

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5879 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2012-11-23 15:31:37 +00:00
parent 6db70b0581
commit da39d1de77
7 changed files with 617 additions and 394 deletions

View file

@ -7,8 +7,8 @@
#include "gxs/rsgxsflags.h" #include "gxs/rsgxsflags.h"
AlbumCreateDialog::AlbumCreateDialog(TokenQueue *photoQueue, RsPhotoV2 *rs_photo, QWidget *parent): AlbumCreateDialog::AlbumCreateDialog(TokenQueue *photoQueue, RsPhotoV2 *rs_photo, QWidget *parent):
QDialog(parent), QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
ui(new Ui::AlbumCreateDialog), mPhotoQueue(photoQueue), mRsPhoto(rs_photo) ui(new Ui::AlbumCreateDialog), mPhotoQueue(photoQueue), mRsPhoto(rs_photo), mPhotoSelected(NULL)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -17,14 +17,25 @@ AlbumCreateDialog::AlbumCreateDialog(TokenQueue *photoQueue, RsPhotoV2 *rs_photo
#if QT_VERSION >= 0x040700 #if QT_VERSION >= 0x040700
ui->lineEdit_Title_2->setPlaceholderText(tr("Untitle Album")) ; 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->textEdit_Description->setPlaceholderText(tr("Say something about this album...")) ;
ui->lineEdit_Where->setPlaceholderText(tr("Where were this taken?")) ; ui->lineEdit_Where->setPlaceholderText(tr("Where were this taken?"));
#endif #endif
ui->backButton->hide();
connect(ui->publishButton, SIGNAL(clicked()), this, SLOT(publishAlbum())); connect(ui->publishButton, SIGNAL(clicked()), this, SLOT(publishAlbum()));
connect(ui->AlbumThumbNail, SIGNAL(clicked()), this, SLOT(addAlbumThumbnail())); 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() AlbumCreateDialog::~AlbumCreateDialog()
@ -68,9 +79,35 @@ void AlbumCreateDialog::publishAlbum()
uint32_t token; uint32_t token;
mRsPhoto->submitAlbumDetails(token, album); mRsPhoto->submitAlbumDetails(token, album);
mPhotoQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, 0); mPhotoQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
publishPhotos();
close(); close();
} }
void AlbumCreateDialog::publishPhotos()
{
// get fields for album to publish, publish and then exit dialog
RsPhotoAlbum album;
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 = album.mMeta.mGroupId;
mRsPhoto->submitPhoto(token, photo);
mPhotoQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
}
}
bool AlbumCreateDialog::getAlbumThumbnail(RsPhotoThumbnail &nail) bool AlbumCreateDialog::getAlbumThumbnail(RsPhotoThumbnail &nail)
{ {
const QPixmap *tmppix = &mThumbNail; const QPixmap *tmppix = &mThumbNail;
@ -111,3 +148,43 @@ void AlbumCreateDialog::addAlbumThumbnail()
// to show the selected // to show the selected
ui->AlbumThumbNail->setIcon(mThumbNail); 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<PhotoItem*>(selection);
if(mPhotoSelected == NULL)
{
return;
}
else
{
mPhotoSelected->setSelected(false);
mPhotoSelected = pItem;
}
mPhotoSelected->setSelected(true);
}

View file

@ -4,13 +4,16 @@
#include <QDialog> #include <QDialog>
#include "util/TokenQueue.h" #include "util/TokenQueue.h"
#include "retroshare/rsphotoV2.h" #include "retroshare/rsphotoV2.h"
#include "PhotoShareItemHolder.h"
#include "PhotoItem.h"
#include "PhotoDrop.h"
namespace Ui { namespace Ui {
class AlbumCreateDialog; class AlbumCreateDialog;
} }
class AlbumCreateDialog : public QDialog class AlbumCreateDialog : public QDialog, public PhotoShareItemHolder
{ {
Q_OBJECT Q_OBJECT
@ -18,9 +21,16 @@ public:
explicit AlbumCreateDialog(TokenQueue* photoQueue, RsPhotoV2* rs_photo, QWidget *parent = 0); explicit AlbumCreateDialog(TokenQueue* photoQueue, RsPhotoV2* rs_photo, QWidget *parent = 0);
~AlbumCreateDialog(); ~AlbumCreateDialog();
void notifySelection(PhotoShareItem* selection);
private slots: private slots:
void publishAlbum(); void publishAlbum();
void publishPhotos();
void addAlbumThumbnail(); void addAlbumThumbnail();
void changePage();
void backPage();
private: private:
@ -31,6 +41,8 @@ private:
TokenQueue* mPhotoQueue; TokenQueue* mPhotoQueue;
RsPhotoV2* mRsPhoto; RsPhotoV2* mRsPhoto;
QPixmap mThumbNail; QPixmap mThumbNail;
PhotoDrop* mPhotoDrop;
PhotoItem* mPhotoSelected;
}; };

View file

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>530</width> <width>643</width>
<height>488</height> <height>550</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -16,7 +16,7 @@
<property name="sizeGripEnabled"> <property name="sizeGripEnabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_4">
<property name="margin"> <property name="margin">
<number>0</number> <number>0</number>
</property> </property>
@ -34,6 +34,13 @@
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page">
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QFrame" name="frame"> <widget class="QFrame" name="frame">
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::StyledPanel</enum>
@ -232,33 +239,6 @@ border-radius: 10px;
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0" colspan="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>419</width>
<height>18</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="3">
<widget class="QPushButton" name="publishButton">
<property name="text">
<string>Publish Album</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel</set>
</property>
</widget>
</item>
<item row="4" column="0" colspan="4"> <item row="4" column="0" colspan="4">
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
<property name="sizePolicy"> <property name="sizePolicy">
@ -413,6 +393,115 @@ border-radius: 10px;
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="page_2">
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_5" stretch="0,10">
<item>
<widget class="QLabel" name="label_17">
<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>98</width>
<height>28</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QWidget#scrollAreaWidgetContents{border: none;}</string>
</property>
<layout class="QGridLayout" name="gridLayout_10"/>
</widget>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
<item row="2" column="0">
<widget class="QFrame" name="">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<number>9</number>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>419</width>
<height>18</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel</set>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="backButton">
<property name="text">
<string>Back</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addphotosButton">
<property name="text">
<string>Add Photos</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="publishButton">
<property name="text">
<string>Publish Album</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
<class>HeaderFrame</class> <class>HeaderFrame</class>
@ -420,27 +509,16 @@ border-radius: 10px;
<header>gui/common/HeaderFrame.h</header> <header>gui/common/HeaderFrame.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>PhotoDrop</class>
<extends>QWidget</extends>
<header>gui/PhotoShare/PhotoDrop.h</header>
<container>1</container>
</customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../images.qrc"/> <include location="../images.qrc"/>
<include location="Photo_images.qrc"/> <include location="Photo_images.qrc"/>
</resources> </resources>
<connections> <connections/>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>AlbumCreateDialog</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>398</x>
<y>466</y>
</hint>
<hint type="destinationlabel">
<x>264</x>
<y>243</y>
</hint>
</hints>
</connection>
</connections>
</ui> </ui>

View file

@ -5,7 +5,7 @@
#include "gxs/rsgxsflags.h" #include "gxs/rsgxsflags.h"
AlbumDialog::AlbumDialog(const RsPhotoAlbum& album, TokenQueue* photoQueue, RsPhotoV2* rs_Photo, QWidget *parent) : AlbumDialog::AlbumDialog(const RsPhotoAlbum& album, TokenQueue* photoQueue, RsPhotoV2* rs_Photo, QWidget *parent) :
QDialog(parent), QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
ui(new Ui::AlbumDialog), mRsPhoto(rs_Photo), mPhotoQueue(photoQueue), mAlbum(album), mPhotoSelected(NULL) ui(new Ui::AlbumDialog), mRsPhoto(rs_Photo), mPhotoQueue(photoQueue), mAlbum(album), mPhotoSelected(NULL)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -35,6 +35,9 @@ void AlbumDialog::setUp()
ui->lineEdit_Caption->setText(QString::fromStdString(mAlbum.mCaption)); ui->lineEdit_Caption->setText(QString::fromStdString(mAlbum.mCaption));
ui->lineEdit_Category->setText(QString::fromStdString(mAlbum.mCategory)); ui->lineEdit_Category->setText(QString::fromStdString(mAlbum.mCategory));
ui->lineEdit_Identity->setText(QString::fromStdString(mAlbum.mMeta.mAuthorId)); ui->lineEdit_Identity->setText(QString::fromStdString(mAlbum.mMeta.mAuthorId));
ui->lineEdit_Where->setText(QString::fromStdString(mAlbum.mWhere));
ui->textEdit_description->setText(QString::fromStdString(mAlbum.mDescription));
QPixmap qtn; QPixmap qtn;
qtn.loadFromData(mAlbum.mThumbnail.data, mAlbum.mThumbnail.size, mAlbum.mThumbnail.type.c_str()); qtn.loadFromData(mAlbum.mThumbnail.data, mAlbum.mThumbnail.size, mAlbum.mThumbnail.type.c_str());

View file

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>649</width> <width>725</width>
<height>436</height> <height>427</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -77,6 +77,13 @@
<string>Summary</string> <string>Summary</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Album Title:</string>
</property>
</widget>
</item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_Title"> <widget class="QLineEdit" name="lineEdit_Title">
<property name="enabled"> <property name="enabled">
@ -97,6 +104,19 @@
</property> </property>
</widget> </widget>
</item> </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>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
<property name="text"> <property name="text">
@ -137,6 +157,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>When</string>
</property>
</widget>
</item>
<item row="4" column="1"> <item row="4" column="1">
<widget class="QLineEdit" name="lineEdit_When"> <widget class="QLineEdit" name="lineEdit_When">
<property name="enabled"> <property name="enabled">
@ -150,32 +177,45 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="5" column="0">
<widget class="QLabel" name="label_9"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Album Title:</string> <string>Description:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="5" column="1" rowspan="2">
<widget class="QLabel" name="label_6"> <widget class="QTextEdit" name="textEdit_description">
<property name="text"> <property name="readOnly">
<string>When</string> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="6" column="0">
<widget class="QLineEdit" name="lineEdit_Category"> <spacer name="verticalSpacer_2">
<property name="enabled"> <property name="orientation">
<bool>false</bool> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizePolicy"> <property name="sizeHint" stdset="0">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <size>
<horstretch>0</horstretch> <width>20</width>
<verstretch>0</verstretch> <height>40</height>
</sizepolicy> </size>
</property> </property>
</widget> </spacer>
</item>
<item row="7" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -254,6 +294,19 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -299,8 +352,8 @@ p, li { white-space: pre-wrap; }
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>625</width> <width>701</width>
<height>112</height> <height>69</height>
</rect> </rect>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">

View file

@ -6,7 +6,7 @@
#include "AddCommentDialog.h" #include "AddCommentDialog.h"
PhotoDialog::PhotoDialog(RsPhotoV2 *rs_photo, const RsPhotoPhoto &photo, QWidget *parent) : PhotoDialog::PhotoDialog(RsPhotoV2 *rs_photo, const RsPhotoPhoto &photo, QWidget *parent) :
QDialog(parent), QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
ui(new Ui::PhotoDialog), mRsPhoto(rs_photo), mPhotoQueue(new TokenQueue(mRsPhoto->getTokenService(), this)), ui(new Ui::PhotoDialog), mRsPhoto(rs_photo), mPhotoQueue(new TokenQueue(mRsPhoto->getTokenService(), this)),
mPhotoDetails(photo) mPhotoDetails(photo)
{ {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Before After
Before After