mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-28 08:54:13 -04:00
Removed references to postedVEG from GxsGroupDialog and associated classes and PostedDialog (GUI does not work now but does not crash)
Removed V2 references: TokenQueueV2 and RsTokReqOptionsV2 are now TokenQueue and RsTokReqOptions and renamed file Added initialisation of Posted back end service successfully Added new msg status flags GXS_SERV::MSG_STATUS_UNPROCESSED and ::MSG_STATUS_UNREAD git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5707 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
dcb64f6631
commit
c518bd2f19
44 changed files with 2379 additions and 3761 deletions
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "PostedItem.h"
|
||||
|
||||
#include <retroshare/rspostedVEG.h>
|
||||
#include <retroshare/rsposted.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
@ -53,7 +53,7 @@ PostedItem::PostedItem(PostedHolder *parent, const RsPostedPost &post)
|
|||
//scoreLabel->setText(QString("1140"));
|
||||
|
||||
// exposed for testing...
|
||||
float score = rsPostedVEG->calcPostScore(post.mMeta);
|
||||
float score = 0;
|
||||
time_t now = time(NULL);
|
||||
|
||||
QString fromLabelTxt = QString(" Age: ") + QString::number(now - post.mMeta.mPublishTs);
|
||||
|
@ -62,7 +62,7 @@ PostedItem::PostedItem(PostedHolder *parent, const RsPostedPost &post)
|
|||
|
||||
uint32_t votes = 0;
|
||||
uint32_t comments = 0;
|
||||
rsPostedVEG->extractPostedCache(post.mMeta.mServiceString, votes, comments);
|
||||
//rsPosted->extractPostedCache(post.mMeta.mServiceString, votes, comments);
|
||||
scoreLabel->setText(QString::number(votes));
|
||||
QString commentLabel = QString("Comments: ") + QString::number(comments);
|
||||
commentLabel += QString(" Votes: ") + QString::number(votes);
|
||||
|
@ -87,247 +87,3 @@ void PostedItem::loadComments()
|
|||
std::cerr << std::endl;
|
||||
mParent->requestComments(mThreadId);
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
PhotoItem::PhotoItem(PhotoHolder *parent, const RsPhotoAlbum &album)
|
||||
:QWidget(NULL), mParent(parent), mType(PHOTO_ITEM_TYPE_ALBUM)
|
||||
{
|
||||
setupUi(this);
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
|
||||
mIsPhoto = false;
|
||||
setDummyText();
|
||||
updateAlbumText(album); // saves: mAlbumDetails = album;
|
||||
updateImage(album.mThumbnail);
|
||||
|
||||
setSelected(false);
|
||||
}
|
||||
|
||||
|
||||
PhotoItem::PhotoItem(PhotoHolder *parent, const RsPhotoPhoto &photo, const RsPhotoAlbum &album)
|
||||
:QWidget(NULL), mParent(parent), mType(PHOTO_ITEM_TYPE_PHOTO)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
|
||||
mIsPhoto = true;
|
||||
|
||||
setDummyText();
|
||||
updatePhotoText(photo); // saves: mPhotoDetails = photo;
|
||||
updateAlbumText(album); // saves: mAlbumDetails = album;
|
||||
|
||||
updateImage(photo.mThumbnail);
|
||||
|
||||
setSelected(false);
|
||||
}
|
||||
|
||||
|
||||
PhotoItem::PhotoItem(PhotoHolder *parent, std::string path) // for new photos.
|
||||
:QWidget(NULL), mParent(parent), mType(PHOTO_ITEM_TYPE_NEW)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
|
||||
setDummyText();
|
||||
mIsPhoto = true;
|
||||
|
||||
int width = 120;
|
||||
int height = 120;
|
||||
|
||||
//QPixmap qtn = QPixmap(QString::fromStdString(path)).scaled(width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
QPixmap qtn = QPixmap(QString::fromStdString(path)).scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
imgLabel->setPixmap(qtn);
|
||||
setSelected(false);
|
||||
}
|
||||
|
||||
void PhotoItem::updateParent(PhotoHolder *parent) // for external construction.
|
||||
{
|
||||
mParent = parent;
|
||||
}
|
||||
|
||||
|
||||
void PhotoItem::setDummyText()
|
||||
{
|
||||
titleLabel->setText(QString("Unknown"));
|
||||
fromBoldLabel->setText(QString("By:"));
|
||||
fromLabel->setText(QString("Unknown"));
|
||||
statusBoldLabel->setText(QString("Where:"));
|
||||
statusLabel->setText(QString("Unknown"));
|
||||
dateBoldLabel->setText(QString("When:"));
|
||||
dateLabel->setText(QString("Unknown"));
|
||||
}
|
||||
|
||||
|
||||
void PhotoItem::updateAlbumText(const RsPhotoAlbum &album)
|
||||
{
|
||||
mAlbumDetails = album;
|
||||
mAlbumDetails.mThumbnail.data = 0;
|
||||
updateText();
|
||||
}
|
||||
|
||||
void PhotoItem::updatePhotoText(const RsPhotoPhoto &photo)
|
||||
{
|
||||
// Save new Photo details.
|
||||
mPhotoDetails = photo;
|
||||
mPhotoDetails.mThumbnail.data = 0;
|
||||
updateText();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PhotoItem::updateText()
|
||||
{
|
||||
// SET Album Values first -> then overwrite with Photo Values.
|
||||
if (mAlbumDetails.mSetFlags & RSPHOTO_FLAGS_ATTRIB_TITLE)
|
||||
{
|
||||
titleLabel->setText(QString::fromUtf8(mAlbumDetails.mMeta.mGroupName.c_str()));
|
||||
}
|
||||
|
||||
// This needs to be fixed!! TODO
|
||||
fromLabel->setText(QString::fromStdString(mAlbumDetails.mMeta.mGroupId));
|
||||
if (mAlbumDetails.mSetFlags & RSPHOTO_FLAGS_ATTRIB_AUTHOR)
|
||||
{
|
||||
// This needs to be fixed!! TODO
|
||||
fromLabel->setText(QString::fromStdString(mAlbumDetails.mMeta.mGroupId));
|
||||
}
|
||||
|
||||
if (mAlbumDetails.mSetFlags & RSPHOTO_FLAGS_ATTRIB_WHERE)
|
||||
{
|
||||
statusLabel->setText(QString::fromUtf8(mAlbumDetails.mWhere.c_str()));
|
||||
}
|
||||
|
||||
if (mAlbumDetails.mSetFlags & RSPHOTO_FLAGS_ATTRIB_WHEN)
|
||||
{
|
||||
dateLabel->setText(QString::fromUtf8(mAlbumDetails.mWhen.c_str()));
|
||||
}
|
||||
|
||||
// NOW Photo Bits.
|
||||
if (mIsPhoto)
|
||||
{
|
||||
if (mPhotoDetails.mSetFlags & RSPHOTO_FLAGS_ATTRIB_TITLE)
|
||||
{
|
||||
titleLabel->setText(QString::fromUtf8(mPhotoDetails.mMeta.mMsgName.c_str()));
|
||||
}
|
||||
|
||||
if (mPhotoDetails.mSetFlags & RSPHOTO_FLAGS_ATTRIB_AUTHOR)
|
||||
{
|
||||
// This needs to be fixed!! TODO
|
||||
fromLabel->setText(QString::fromStdString(mPhotoDetails.mMeta.mAuthorId));
|
||||
}
|
||||
|
||||
if (mPhotoDetails.mSetFlags & RSPHOTO_FLAGS_ATTRIB_WHERE)
|
||||
{
|
||||
statusLabel->setText(QString::fromUtf8(mPhotoDetails.mWhere.c_str()));
|
||||
}
|
||||
|
||||
if (mPhotoDetails.mSetFlags & RSPHOTO_FLAGS_ATTRIB_WHEN)
|
||||
{
|
||||
dateLabel->setText(QString::fromUtf8(mPhotoDetails.mWhen.c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PhotoItem::updateImage(const RsPhotoThumbnail &thumbnail)
|
||||
{
|
||||
if (thumbnail.data != NULL)
|
||||
{
|
||||
QPixmap qtn;
|
||||
qtn.loadFromData(thumbnail.data, thumbnail.size, thumbnail.type.c_str());
|
||||
imgLabel->setPixmap(qtn);
|
||||
}
|
||||
}
|
||||
|
||||
bool PhotoItem::getPhotoThumbnail(RsPhotoThumbnail &nail)
|
||||
{
|
||||
const QPixmap *tmppix = imgLabel->pixmap();
|
||||
|
||||
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::removeItem()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "PhotoItem::removeItem()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
hide();
|
||||
if (mParent)
|
||||
{
|
||||
mParent->deletePhotoItem(this, mType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PhotoItem::setSelected(bool on)
|
||||
{
|
||||
mSelected = on;
|
||||
if (mSelected)
|
||||
{
|
||||
mParent->notifySelection(this, mType);
|
||||
frame->setStyleSheet("QFrame#frame{border: 2px solid #55CC55;\nbackground: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #55EE55, stop: 1 #CCCCCC);\nborder-radius: 10px}");
|
||||
}
|
||||
else
|
||||
{
|
||||
frame->setStyleSheet("QFrame#frame{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::isSelected()
|
||||
{
|
||||
return mSelected;
|
||||
}
|
||||
|
||||
|
||||
void PhotoItem::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
/* We can be very cunning here?
|
||||
* grab out position.
|
||||
* flag ourselves as selected.
|
||||
* then pass the mousePressEvent up for handling by the parent
|
||||
*/
|
||||
|
||||
QPoint pos = event->pos();
|
||||
|
||||
std::cerr << "PhotoItem::mousePressEvent(" << pos.x() << ", " << pos.y() << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
setSelected(true);
|
||||
|
||||
QWidget::mousePressEvent(event);
|
||||
}
|
||||
|
||||
|
||||
const QPixmap *PhotoItem::getPixmap()
|
||||
{
|
||||
return imgLabel->pixmap();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue