mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-29 16:53:31 -05:00
Fixed utf8 handling in photo comments.
Some cosmetic changes. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5715 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
bb9a80e95b
commit
6e04229d39
@ -7,11 +7,14 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>465</width>
|
||||
<height>347</height>
|
||||
<height>356</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
<string>Create Album</string>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
|
@ -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()));
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef ALBUMDIALOG_H
|
||||
#define ALBUMDIALOG_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QDialog>
|
||||
#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
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AlbumDialog</class>
|
||||
<widget class="QWidget" name="AlbumDialog">
|
||||
<widget class="QDialog" name="AlbumDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@ -11,7 +11,14 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string>Album</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
@ -278,7 +285,7 @@ p, li { white-space: pre-wrap; }
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>627</width>
|
||||
<height>116</height>
|
||||
<height>107</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
@ -353,6 +360,8 @@ p, li { white-space: pre-wrap; }
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -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");
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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<PhotoCommentItem*> mComments;
|
||||
AddCommentDialog* mCommentDialog;
|
||||
|
||||
};
|
||||
|
||||
#endif // PHOTODIALOG_H
|
||||
|
@ -10,15 +10,16 @@
|
||||
<height>566</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>PhotoShare</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="albumGroup">
|
||||
@ -54,7 +55,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" rowspan="2" colspan="2">
|
||||
<item row="0" column="1" rowspan="2" colspan="4">
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
@ -76,7 +77,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>325</width>
|
||||
<width>369</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -194,8 +195,15 @@
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QPushButton" name="pushButton_AddCommentDlg">
|
||||
<property name="text">
|
||||
<string>Add Comment</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QToolButton" name="toolButton_AddComment">
|
||||
<widget class="QPushButton" name="pushButton_AddComment">
|
||||
<property name="text">
|
||||
<string>Comment</string>
|
||||
</property>
|
||||
@ -203,6 +211,8 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -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()
|
||||
|
@ -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<std::string>& ids);
|
||||
void requestAlbumData(std::list<RsGxsGroupId> &ids);
|
||||
@ -83,13 +80,9 @@ private:
|
||||
void updatePhotos();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
AlbumItem* mAlbumSelected;
|
||||
PhotoItem* mPhotoSelected;
|
||||
PhotoSlideShow* mSlideShow;
|
||||
AlbumDialog* mAlbumDialog;
|
||||
PhotoDialog* mPhotoDialog;
|
||||
|
||||
|
||||
TokenQueue *mPhotoQueue;
|
||||
|
||||
|
@ -10,9 +10,6 @@
|
||||
<height>671</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
@ -137,8 +134,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../LinksCloud/images.qrc"/>
|
||||
</resources>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -10,24 +10,16 @@
|
||||
<height>557</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="tabsClosable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../LinksCloud/images.qrc"/>
|
||||
</resources>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -47,7 +47,7 @@
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::NoContextMenu</enum>
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="movable">
|
||||
<bool>true</bool>
|
||||
|
Loading…
x
Reference in New Issue
Block a user