mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-13 16:39:43 -05:00
Improvements for New Services.
* Forums now loads example data... * new Posted Service, only the basics for now. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-new_cache_system@5269 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
d83e1ea6ec
commit
f05d2f9b09
@ -4,6 +4,7 @@ CONFIG += wikipoos
|
|||||||
CONFIG += thewire
|
CONFIG += thewire
|
||||||
CONFIG += identities
|
CONFIG += identities
|
||||||
CONFIG += forumsv2
|
CONFIG += forumsv2
|
||||||
|
CONFIG += posted
|
||||||
CONFIG += unfinished
|
CONFIG += unfinished
|
||||||
|
|
||||||
QT += network xml script
|
QT += network xml script
|
||||||
@ -956,3 +957,23 @@ forumsv2 {
|
|||||||
gui/forumsv2/CreateForumV2Msg.cpp \
|
gui/forumsv2/CreateForumV2Msg.cpp \
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
posted {
|
||||||
|
|
||||||
|
HEADERS += gui/Posted/PostedDialog.h \
|
||||||
|
gui/Posted/PostedListDialog.h \
|
||||||
|
gui/Posted/PostedItem.h \
|
||||||
|
gui/Posted/PostedComments.h \
|
||||||
|
|
||||||
|
FORMS += gui/Posted/PostedDialog.ui \
|
||||||
|
gui/Posted/PostedListDialog.ui \
|
||||||
|
gui/Posted/PostedItem.ui \
|
||||||
|
gui/Posted/PostedComments.ui \
|
||||||
|
|
||||||
|
SOURCES += gui/Posted/PostedDialog.cpp \
|
||||||
|
gui/Posted/PostedListDialog.cpp \
|
||||||
|
gui/Posted/PostedItem.cpp \
|
||||||
|
gui/Posted/PostedComments.cpp \
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -141,6 +141,12 @@ ForumsV2Dialog::ForumsV2Dialog(QWidget *parent)
|
|||||||
m_bProcessSettings = false;
|
m_bProcessSettings = false;
|
||||||
subscribeFlags = 0;
|
subscribeFlags = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/* Setup Queue */
|
||||||
|
mForumQueue = new TokenQueue(rsForumsV2, this);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
connect( ui.forumTreeWidget, SIGNAL( treeCustomContextMenuRequested( QPoint ) ), this, SLOT( forumListCustomPopupMenu( QPoint ) ) );
|
connect( ui.forumTreeWidget, SIGNAL( treeCustomContextMenuRequested( QPoint ) ), this, SLOT( forumListCustomPopupMenu( QPoint ) ) );
|
||||||
connect( ui.threadTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( threadListCustomPopupMenu( QPoint ) ) );
|
connect( ui.threadTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( threadListCustomPopupMenu( QPoint ) ) );
|
||||||
|
|
||||||
@ -478,7 +484,8 @@ void ForumsV2Dialog::updateDisplay()
|
|||||||
if (!rsForumsV2)
|
if (!rsForumsV2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (rsForumsV2->groupsChanged(forumIds))
|
// TODO groupsChanged... HACK XXX.
|
||||||
|
if ((rsForumsV2->groupsChanged(forumIds)) || (rsForumsV2->updated()))
|
||||||
{
|
{
|
||||||
/* update Forums List */
|
/* update Forums List */
|
||||||
insertForums();
|
insertForums();
|
||||||
@ -1812,6 +1819,9 @@ void ForumsV2Dialog::requestGroupSummary_CurrentForum(const std::string &forumId
|
|||||||
std::list<std::string> grpIds;
|
std::list<std::string> grpIds;
|
||||||
grpIds.push_back(forumId);
|
grpIds.push_back(forumId);
|
||||||
|
|
||||||
|
std::cerr << "ForumsV2Dialog::requestGroupSummary_CurrentForum(" << forumId << ")";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mForumQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, grpIds, FORUMSV2DIALOG_CURRENTFORUM);
|
mForumQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, grpIds, FORUMSV2DIALOG_CURRENTFORUM);
|
||||||
}
|
}
|
||||||
@ -1845,10 +1855,16 @@ void ForumsV2Dialog::loadGroupSummary_CurrentForum(const uint32_t &token)
|
|||||||
|
|
||||||
void ForumsV2Dialog::loadCurrentForumThreads(const std::string &forumId)
|
void ForumsV2Dialog::loadCurrentForumThreads(const std::string &forumId)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
std::cerr << "ForumsV2Dialog::loadCurrentForumThreads(" << forumId << ")";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
/* if already active -> kill current loading */
|
/* if already active -> kill current loading */
|
||||||
if (mThreadLoading)
|
if (mThreadLoading)
|
||||||
{
|
{
|
||||||
/* Cleanup */
|
/* Cleanup */
|
||||||
|
std::cerr << "ForumsV2Dialog::loadCurrentForumThreads() Cleanup old Threads";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
/* Wipe Widget Tree */
|
/* Wipe Widget Tree */
|
||||||
mThreadLoad.Items.clear();
|
mThreadLoad.Items.clear();
|
||||||
@ -1857,6 +1873,9 @@ void ForumsV2Dialog::loadCurrentForumThreads(const std::string &forumId)
|
|||||||
std::map<uint32_t, QTreeWidgetItem *>::iterator it;
|
std::map<uint32_t, QTreeWidgetItem *>::iterator it;
|
||||||
for(it = mThreadLoad.MsgTokens.begin(); it != mThreadLoad.MsgTokens.end(); it++)
|
for(it = mThreadLoad.MsgTokens.begin(); it != mThreadLoad.MsgTokens.end(); it++)
|
||||||
{
|
{
|
||||||
|
std::cerr << "ForumsV2Dialog::loadCurrentForumThreads() Canceling Request: " << it->first;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
mForumQueue->cancelRequest(it->first);
|
mForumQueue->cancelRequest(it->first);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1865,6 +1884,9 @@ void ForumsV2Dialog::loadCurrentForumThreads(const std::string &forumId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* initiate loading */
|
/* initiate loading */
|
||||||
|
std::cerr << "ForumsV2Dialog::loadCurrentForumThreads() Initiating Loading";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
mThreadLoading = true;
|
mThreadLoading = true;
|
||||||
|
|
||||||
mThreadLoad.ForumId = mCurrForumId;
|
mThreadLoad.ForumId = mCurrForumId;
|
||||||
@ -1913,6 +1935,9 @@ void ForumsV2Dialog::requestGroupThreadData_InsertThreads(const std::string &for
|
|||||||
std::list<std::string> grpIds;
|
std::list<std::string> grpIds;
|
||||||
grpIds.push_back(forumId);
|
grpIds.push_back(forumId);
|
||||||
|
|
||||||
|
std::cerr << "ForumsV2Dialog::requestGroupThreadData_InsertThreads(" << forumId << ")";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mForumQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, FORUMSV2DIALOG_INSERTTHREADS);
|
mForumQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, FORUMSV2DIALOG_INSERTTHREADS);
|
||||||
}
|
}
|
||||||
@ -2045,6 +2070,9 @@ void ForumsV2Dialog::requestChildData_InsertThreads(uint32_t &token, const std::
|
|||||||
std::list<std::string> msgIds;
|
std::list<std::string> msgIds;
|
||||||
msgIds.push_back(parentId);
|
msgIds.push_back(parentId);
|
||||||
|
|
||||||
|
std::cerr << "ForumsV2Dialog::requestChildData_InsertThreads(" << parentId << ")";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
mForumQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, FORUMSV2DIALOG_INSERTCHILD);
|
mForumQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, FORUMSV2DIALOG_INSERTCHILD);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2157,6 +2185,10 @@ void ForumsV2Dialog::requestMsgData_InsertPost(const std::string &msgId)
|
|||||||
std::list<std::string> msgIds;
|
std::list<std::string> msgIds;
|
||||||
msgIds.push_back(msgId);
|
msgIds.push_back(msgId);
|
||||||
|
|
||||||
|
std::cerr << "ForumsV2Dialog::requestMsgData_InsertPost(" << msgId << ")";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mForumQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, FORUMV2DIALOG_INSERT_POST);
|
mForumQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, FORUMV2DIALOG_INSERT_POST);
|
||||||
}
|
}
|
||||||
@ -2190,6 +2222,9 @@ void ForumsV2Dialog::requestMsgData_ReplyMessage(const std::string &msgId)
|
|||||||
std::list<std::string> msgIds;
|
std::list<std::string> msgIds;
|
||||||
msgIds.push_back(msgId);
|
msgIds.push_back(msgId);
|
||||||
|
|
||||||
|
std::cerr << "ForumsV2Dialog::requestMsgData_ReplyMessage(" << msgId << ")";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
mForumQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, FORUMV2DIALOG_REPLY_MESSAGE);
|
mForumQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, FORUMV2DIALOG_REPLY_MESSAGE);
|
||||||
}
|
}
|
||||||
|
627
retroshare-gui/src/gui/Posted/PostedComments.cpp
Normal file
627
retroshare-gui/src/gui/Posted/PostedComments.cpp
Normal file
@ -0,0 +1,627 @@
|
|||||||
|
/*
|
||||||
|
* Retroshare Posted Comments
|
||||||
|
*
|
||||||
|
* Copyright 2012-2012 by Robert Fernie.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License Version 2.1 as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
|
* USA.
|
||||||
|
*
|
||||||
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "PostedComments.h"
|
||||||
|
|
||||||
|
//#include <retroshare/rspeers.h>
|
||||||
|
#include <retroshare/rsposted.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
/******
|
||||||
|
* #define PHOTO_DEBUG 1
|
||||||
|
*****/
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************
|
||||||
|
* New Photo Display Widget.
|
||||||
|
*
|
||||||
|
* This has two 'lists'.
|
||||||
|
* Top list shows Albums.
|
||||||
|
* Lower list is photos from the selected Album.
|
||||||
|
*
|
||||||
|
* Notes:
|
||||||
|
* Each Item will be an AlbumItem, which contains a thumbnail & random details.
|
||||||
|
* We will limit Items to < 100. With a 'Filter to see more message.
|
||||||
|
*
|
||||||
|
* Thumbnails will come from Service.
|
||||||
|
* Option to Share albums / pictures onward (if permissions allow).
|
||||||
|
* Option to Download the albums to a specified directory. (is this required if sharing an album?)
|
||||||
|
*
|
||||||
|
* Will introduce a FullScreen SlideShow later... first get basics happening.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** Constructor */
|
||||||
|
PostedComments::PostedComments(QWidget *parent)
|
||||||
|
:QWidget(parent)
|
||||||
|
{
|
||||||
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
mAddDialog = NULL;
|
||||||
|
mAlbumSelected = NULL;
|
||||||
|
mPhotoSelected = NULL;
|
||||||
|
mSlideShow = NULL;
|
||||||
|
|
||||||
|
connect( ui.toolButton_NewAlbum, SIGNAL(clicked()), this, SLOT(OpenOrShowPhotoAddDialog()));
|
||||||
|
connect( ui.toolButton_EditAlbum, SIGNAL(clicked()), this, SLOT(OpenPhotoEditDialog()));
|
||||||
|
connect( ui.toolButton_SlideShow, SIGNAL(clicked()), this, SLOT(OpenSlideShow()));
|
||||||
|
|
||||||
|
QTimer *timer = new QTimer(this);
|
||||||
|
timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
|
||||||
|
timer->start(1000);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* setup TokenQueue */
|
||||||
|
//mPhotoQueue = new TokenQueue(rsPhoto, this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
|
void PhotoDialog::notifySelection(PhotoItem *item, int ptype)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::notifySelection() from : " << ptype << " " << item;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
switch(ptype)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case PHOTO_ITEM_TYPE_ALBUM:
|
||||||
|
notifyAlbumSelection(item);
|
||||||
|
break;
|
||||||
|
case PHOTO_ITEM_TYPE_PHOTO:
|
||||||
|
notifyPhotoSelection(item);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhotoDialog::notifyAlbumSelection(PhotoItem *item)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::notifyAlbumSelection() from : " << item;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
if (mAlbumSelected)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::notifyAlbumSelection() unselecting old one : " << mAlbumSelected;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
mAlbumSelected->setSelected(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
mAlbumSelected = item;
|
||||||
|
insertPhotosForSelectedAlbum();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PhotoDialog::notifyPhotoSelection(PhotoItem *item)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::notifyPhotoSelection() from : " << item;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
if (mPhotoSelected)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::notifyPhotoSelection() unselecting old one : " << mPhotoSelected;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
mPhotoSelected->setSelected(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
mPhotoSelected = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PhotoDialog::checkUpdate()
|
||||||
|
{
|
||||||
|
/* update */
|
||||||
|
if (!rsPhoto)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (rsPhoto->updated())
|
||||||
|
{
|
||||||
|
//insertAlbums();
|
||||||
|
requestAlbumList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************** New Photo Dialog ***************/
|
||||||
|
|
||||||
|
void PhotoDialog::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;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mAlbumSelected->mIsPhoto)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::OpenPhotoEditDialog() MAJOR ERROR!";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string albumId = mAlbumSelected->mAlbumDetails.mMeta.mGroupId;
|
||||||
|
|
||||||
|
if (mSlideShow)
|
||||||
|
{
|
||||||
|
mSlideShow->show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mSlideShow = new PhotoSlideShow(NULL);
|
||||||
|
mSlideShow->show();
|
||||||
|
}
|
||||||
|
mSlideShow->loadAlbum(albumId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************** New Photo Dialog ***************/
|
||||||
|
|
||||||
|
void PhotoDialog::OpenOrShowPhotoAddDialog()
|
||||||
|
{
|
||||||
|
if (mAddDialog)
|
||||||
|
{
|
||||||
|
mAddDialog->show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mAddDialog = new PhotoAddDialog(NULL);
|
||||||
|
mAddDialog->show();
|
||||||
|
}
|
||||||
|
mAddDialog->clearDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************** Edit Photo Dialog ***************/
|
||||||
|
|
||||||
|
void PhotoDialog::OpenPhotoEditDialog()
|
||||||
|
{
|
||||||
|
/* check if we have an album selected */
|
||||||
|
// THE TWO MessageBoxes - should be handled by disabling the Button!.
|
||||||
|
// 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 (mAlbumSelected->mIsPhoto)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::OpenPhotoEditDialog() MAJOR ERROR!";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string albumId = mAlbumSelected->mAlbumDetails.mMeta.mGroupId;
|
||||||
|
#if 0
|
||||||
|
uint32_t flags = mAlbumSelected->mAlbumDetails.mMeta.mGroupFlags;
|
||||||
|
|
||||||
|
if (!(flags & OWN))
|
||||||
|
{
|
||||||
|
// ALERT.
|
||||||
|
int ret = QMessageBox::information(this, tr("PhotoShare"),
|
||||||
|
tr("Cannot Edit Someone Else's Album"),
|
||||||
|
QMessageBox::Ok);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
OpenOrShowPhotoAddDialog();
|
||||||
|
mAddDialog->loadAlbum(albumId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool PhotoDialog::matchesAlbumFilter(const RsPhotoAlbum &album)
|
||||||
|
{
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
double PhotoDialog::AlbumScore(const RsPhotoAlbum &album)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool PhotoDialog::matchesPhotoFilter(const RsPhotoPhoto &photo)
|
||||||
|
{
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
double PhotoDialog::PhotoScore(const RsPhotoPhoto &photo)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhotoDialog::insertPhotosForSelectedAlbum()
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::insertPhotosForSelectedAlbum()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
clearPhotos();
|
||||||
|
|
||||||
|
//std::list<std::string> albumIds;
|
||||||
|
if (mAlbumSelected)
|
||||||
|
{
|
||||||
|
if (mAlbumSelected->mIsPhoto)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::insertPhotosForSelectedAlbum() MAJOR ERROR!";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string albumId = mAlbumSelected->mAlbumDetails.mMeta.mGroupId;
|
||||||
|
//albumIds.push_back(albumId);
|
||||||
|
|
||||||
|
std::cerr << "PhotoDialog::insertPhotosForSelectedAlbum() AlbumId: " << albumId;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
requestPhotoList(albumId);
|
||||||
|
}
|
||||||
|
//requestPhotoList(albumIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PhotoDialog::clearAlbums()
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::clearAlbums()" << std::endl;
|
||||||
|
|
||||||
|
std::list<PhotoItem *> photoItems;
|
||||||
|
std::list<PhotoItem *>::iterator pit;
|
||||||
|
|
||||||
|
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||||
|
int count = alayout->count();
|
||||||
|
for(int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
QLayoutItem *litem = alayout->itemAt(i);
|
||||||
|
if (!litem)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::clearAlbums() missing litem";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
PhotoItem *item = dynamic_cast<PhotoItem *>(litem->widget());
|
||||||
|
if (item)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::clearAlbums() item: " << item;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
photoItems.push_back(item);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::clearAlbums() Found Child, which is not a PhotoItem???";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(pit = photoItems.begin(); pit != photoItems.end(); pit++)
|
||||||
|
{
|
||||||
|
PhotoItem *item = *pit;
|
||||||
|
alayout->removeWidget(item);
|
||||||
|
delete item;
|
||||||
|
}
|
||||||
|
mAlbumSelected = NULL;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhotoDialog::clearPhotos()
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::clearPhotos()" << std::endl;
|
||||||
|
|
||||||
|
std::list<PhotoItem *> photoItems;
|
||||||
|
std::list<PhotoItem *>::iterator pit;
|
||||||
|
|
||||||
|
QLayout *alayout = ui.scrollAreaWidgetContents_2->layout();
|
||||||
|
int count = alayout->count();
|
||||||
|
for(int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
QLayoutItem *litem = alayout->itemAt(i);
|
||||||
|
if (!litem)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::clearPhotos() missing litem";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
PhotoItem *item = dynamic_cast<PhotoItem *>(litem->widget());
|
||||||
|
if (item)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::clearPhotos() item: " << item;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
photoItems.push_back(item);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::clearPhotos() Found Child, which is not a PhotoItem???";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(pit = photoItems.begin(); pit != photoItems.end(); pit++)
|
||||||
|
{
|
||||||
|
PhotoItem *item = *pit;
|
||||||
|
alayout->removeWidget(item);
|
||||||
|
delete item;
|
||||||
|
}
|
||||||
|
|
||||||
|
mPhotoSelected = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhotoDialog::addAlbum(const RsPhotoAlbum &album)
|
||||||
|
{
|
||||||
|
std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl;
|
||||||
|
|
||||||
|
PhotoItem *item = new PhotoItem(this, album);
|
||||||
|
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||||
|
alayout->addWidget(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PhotoDialog::addPhoto(const RsPhotoPhoto &photo)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::addPhoto() AlbumId: " << photo.mMeta.mGroupId;
|
||||||
|
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
RsPhotoAlbum dummyAlbum;
|
||||||
|
dummyAlbum.mSetFlags = 0;
|
||||||
|
|
||||||
|
PhotoItem *item = new PhotoItem(this, photo, dummyAlbum);
|
||||||
|
QLayout *alayout = ui.scrollAreaWidgetContents_2->layout();
|
||||||
|
alayout->addWidget(item);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhotoDialog::deletePhotoItem(PhotoItem *item, uint32_t type)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**************************** Request / Response Filling of Data ************************/
|
||||||
|
|
||||||
|
|
||||||
|
void PhotoDialog::requestAlbumList()
|
||||||
|
{
|
||||||
|
|
||||||
|
std::list<std::string> ids;
|
||||||
|
RsTokReqOptions opts;
|
||||||
|
uint32_t token;
|
||||||
|
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PhotoDialog::loadAlbumList(const uint32_t &token)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::loadAlbumList()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
std::list<std::string> albumIds;
|
||||||
|
rsPhoto->getGroupList(token, albumIds);
|
||||||
|
|
||||||
|
requestAlbumData(albumIds);
|
||||||
|
|
||||||
|
clearPhotos();
|
||||||
|
|
||||||
|
std::list<std::string>::iterator it;
|
||||||
|
for(it = albumIds.begin(); it != albumIds.end(); it++)
|
||||||
|
{
|
||||||
|
requestPhotoList(*it);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PhotoDialog::requestAlbumData(const std::list<std::string> &ids)
|
||||||
|
{
|
||||||
|
RsTokReqOptions opts;
|
||||||
|
uint32_t token;
|
||||||
|
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, ids, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool PhotoDialog::loadAlbumData(const uint32_t &token)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::loadAlbumData()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
clearAlbums();
|
||||||
|
|
||||||
|
bool moreData = true;
|
||||||
|
while(moreData)
|
||||||
|
{
|
||||||
|
RsPhotoAlbum album;
|
||||||
|
if (rsPhoto->getAlbum(token, album))
|
||||||
|
{
|
||||||
|
std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl;
|
||||||
|
|
||||||
|
PhotoItem *item = new PhotoItem(this, album);
|
||||||
|
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||||
|
alayout->addWidget(item);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
moreData = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PhotoDialog::requestPhotoList(const std::string &albumId)
|
||||||
|
{
|
||||||
|
|
||||||
|
std::list<std::string> ids;
|
||||||
|
ids.push_back(albumId);
|
||||||
|
RsTokReqOptions opts;
|
||||||
|
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
||||||
|
uint32_t token;
|
||||||
|
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void PhotoDialog::loadPhotoList(const uint32_t &token)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::loadPhotoList()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
std::list<std::string> photoIds;
|
||||||
|
|
||||||
|
rsPhoto->getMsgList(token, photoIds);
|
||||||
|
requestPhotoData(photoIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PhotoDialog::requestPhotoData(const std::list<std::string> &photoIds)
|
||||||
|
{
|
||||||
|
RsTokReqOptions opts;
|
||||||
|
uint32_t token;
|
||||||
|
mPhotoQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, photoIds, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PhotoDialog::loadPhotoData(const uint32_t &token)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::loadPhotoData()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
bool moreData = true;
|
||||||
|
while(moreData)
|
||||||
|
{
|
||||||
|
RsPhotoPhoto photo;
|
||||||
|
|
||||||
|
if (rsPhoto->getPhoto(token, photo))
|
||||||
|
{
|
||||||
|
|
||||||
|
std::cerr << "PhotoDialog::loadPhotoData() AlbumId: " << photo.mMeta.mGroupId;
|
||||||
|
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
addPhoto(photo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
moreData = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/********************************/
|
||||||
|
|
||||||
|
void PhotoDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::loadRequest()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
if (queue == mPhotoQueue)
|
||||||
|
{
|
||||||
|
/* now switch on req */
|
||||||
|
switch(req.mType)
|
||||||
|
{
|
||||||
|
case TOKENREQ_GROUPINFO:
|
||||||
|
switch(req.mAnsType)
|
||||||
|
{
|
||||||
|
case RS_TOKREQ_ANSTYPE_LIST:
|
||||||
|
loadAlbumList(req.mToken);
|
||||||
|
break;
|
||||||
|
case RS_TOKREQ_ANSTYPE_DATA:
|
||||||
|
loadAlbumData(req.mToken);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
std::cerr << "PhotoDialog::loadRequest() ERROR: GROUP: INVALID ANS TYPE";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TOKENREQ_MSGINFO:
|
||||||
|
switch(req.mAnsType)
|
||||||
|
{
|
||||||
|
case RS_TOKREQ_ANSTYPE_LIST:
|
||||||
|
loadPhotoList(req.mToken);
|
||||||
|
break;
|
||||||
|
//case RS_TOKREQ_ANSTYPE_DATA:
|
||||||
|
// loadPhotoData(req.mToken);
|
||||||
|
// break;
|
||||||
|
default:
|
||||||
|
std::cerr << "PhotoDialog::loadRequest() ERROR: MSG: INVALID ANS TYPE";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TOKENREQ_MSGRELATEDINFO:
|
||||||
|
switch(req.mAnsType)
|
||||||
|
{
|
||||||
|
case RS_TOKREQ_ANSTYPE_DATA:
|
||||||
|
loadPhotoData(req.mToken);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
std::cerr << "PhotoDialog::loadRequest() ERROR: MSG: INVALID ANS TYPE";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
std::cerr << "PhotoDialog::loadRequest() ERROR: INVALID TYPE";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
118
retroshare-gui/src/gui/Posted/PostedComments.h
Normal file
118
retroshare-gui/src/gui/Posted/PostedComments.h
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
/*
|
||||||
|
* Retroshare Posted Comments
|
||||||
|
*
|
||||||
|
* Copyright 2012-2012 by Robert Fernie.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License Version 2.1 as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
|
* USA.
|
||||||
|
*
|
||||||
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MRK_POSTED_COMMENTS_H
|
||||||
|
#define MRK_POSTED_COMMENTS_H
|
||||||
|
|
||||||
|
//#include "gui/mainpage.h"
|
||||||
|
#include "ui_PostedComments.h"
|
||||||
|
|
||||||
|
#include <retroshare/rsposted.h>
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
//#include "gui/Posted/PostedItem.h"
|
||||||
|
//#include "gui/PhotoShare/PhotoAddDialog.h"
|
||||||
|
//#include "gui/PhotoShare/PhotoSlideShow.h"
|
||||||
|
#include "util/TokenQueue.h"
|
||||||
|
|
||||||
|
class PostedComments: public QWidget, public TokenResponse
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
PostedComments(QWidget *parent = 0);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void loadRequest(const TokenQueue *queue, const TokenRequest &req) { return; }
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
virtual void deletePhotoItem(PhotoItem *, uint32_t type);
|
||||||
|
virtual void notifySelection(PhotoItem *item, int ptype);
|
||||||
|
|
||||||
|
void notifyAlbumSelection(PhotoItem *item);
|
||||||
|
void notifyPhotoSelection(PhotoItem *item);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
void checkUpdate();
|
||||||
|
void OpenOrShowPhotoAddDialog();
|
||||||
|
void OpenPhotoEditDialog();
|
||||||
|
void OpenSlideShow();
|
||||||
|
private:
|
||||||
|
|
||||||
|
/* Request Response Functions for loading data */
|
||||||
|
void requestAlbumList();
|
||||||
|
void requestAlbumData(const std::list<std::string> &ids);
|
||||||
|
void requestPhotoList(const std::string &albumId);
|
||||||
|
void requestPhotoData(const std::list<std::string> &photoIds);
|
||||||
|
|
||||||
|
void loadAlbumList(const uint32_t &token);
|
||||||
|
bool loadAlbumData(const uint32_t &token);
|
||||||
|
void loadPhotoList(const uint32_t &token);
|
||||||
|
void loadPhotoData(const uint32_t &token);
|
||||||
|
|
||||||
|
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||||
|
|
||||||
|
|
||||||
|
/* TODO: These functions must be filled in for proper filtering to work
|
||||||
|
* and tied to the GUI input
|
||||||
|
*/
|
||||||
|
|
||||||
|
bool matchesAlbumFilter(const RsPhotoAlbum &album);
|
||||||
|
double AlbumScore(const RsPhotoAlbum &album);
|
||||||
|
bool matchesPhotoFilter(const RsPhotoPhoto &photo);
|
||||||
|
double PhotoScore(const RsPhotoPhoto &photo);
|
||||||
|
|
||||||
|
/* Grunt work of setting up the GUI */
|
||||||
|
|
||||||
|
//bool FilterNSortAlbums(const std::list<std::string> &albumIds, std::list<std::string> &filteredAlbumIds, int count);
|
||||||
|
//bool FilterNSortPhotos(const std::list<std::string> &photoIds, std::list<std::string> &filteredPhotoIds, int count);
|
||||||
|
//void insertAlbums();
|
||||||
|
//void insertPhotosForAlbum(const std::list<std::string> &albumIds);
|
||||||
|
|
||||||
|
void insertPhotosForSelectedAlbum();
|
||||||
|
|
||||||
|
void addAlbum(const RsPhotoAlbum &album);
|
||||||
|
void addPhoto(const RsPhotoPhoto &photo);
|
||||||
|
|
||||||
|
void clearAlbums();
|
||||||
|
void clearPhotos();
|
||||||
|
|
||||||
|
PhotoAddDialog *mAddDialog;
|
||||||
|
PhotoSlideShow *mSlideShow;
|
||||||
|
|
||||||
|
PhotoItem *mAlbumSelected;
|
||||||
|
PhotoItem *mPhotoSelected;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
TokenQueue *mPhotoQueue;
|
||||||
|
|
||||||
|
/* UI - from Designer */
|
||||||
|
Ui::PostedComments ui;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
169
retroshare-gui/src/gui/Posted/PostedComments.ui
Normal file
169
retroshare-gui/src/gui/Posted/PostedComments.ui
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>PostedComments</class>
|
||||||
|
<widget class="QWidget" name="PostedComments">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>632</width>
|
||||||
|
<height>398</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Hot</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>New</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Top</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Today</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Yesterday</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>This Week</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>This Month</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>This Year</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Refresh</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Showing 1-100</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>Prev</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Next</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QScrollArea" name="scrollArea">
|
||||||
|
<property name="widgetResizable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>382</width>
|
||||||
|
<height>302</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" rowspan="2">
|
||||||
|
<widget class="QTreeWidget" name="treeWidget">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">1</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
670
retroshare-gui/src/gui/Posted/PostedDialog.cpp
Normal file
670
retroshare-gui/src/gui/Posted/PostedDialog.cpp
Normal file
@ -0,0 +1,670 @@
|
|||||||
|
/*
|
||||||
|
* Retroshare Posted List
|
||||||
|
*
|
||||||
|
* Copyright 2012-2012 by Robert Fernie.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License Version 2.1 as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
|
* USA.
|
||||||
|
*
|
||||||
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "PostedDialog.h"
|
||||||
|
|
||||||
|
#include "PostedListDialog.h"
|
||||||
|
#include "PostedComments.h"
|
||||||
|
|
||||||
|
#include <retroshare/rsposted.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
/******
|
||||||
|
* #define PHOTO_DEBUG 1
|
||||||
|
*****/
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************
|
||||||
|
* New Photo Display Widget.
|
||||||
|
*
|
||||||
|
* This has two 'lists'.
|
||||||
|
* Top list shows Albums.
|
||||||
|
* Lower list is photos from the selected Album.
|
||||||
|
*
|
||||||
|
* Notes:
|
||||||
|
* Each Item will be an AlbumItem, which contains a thumbnail & random details.
|
||||||
|
* We will limit Items to < 100. With a 'Filter to see more message.
|
||||||
|
*
|
||||||
|
* Thumbnails will come from Service.
|
||||||
|
* Option to Share albums / pictures onward (if permissions allow).
|
||||||
|
* Option to Download the albums to a specified directory. (is this required if sharing an album?)
|
||||||
|
*
|
||||||
|
* Will introduce a FullScreen SlideShow later... first get basics happening.
|
||||||
|
*/
|
||||||
|
|
||||||
|
PostedDialog::PostedDialog(QWidget *parent)
|
||||||
|
: MainPage(parent)
|
||||||
|
{
|
||||||
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
mPostedList = new PostedListDialog(NULL);
|
||||||
|
mPostedComments = new PostedComments(NULL);
|
||||||
|
|
||||||
|
ui.tabWidget->addTab(mPostedList, QString("List"));
|
||||||
|
ui.tabWidget->addTab(mPostedComments, QString("Comments"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** Constructor */
|
||||||
|
PhotoDialog::PhotoDialog(QWidget *parent)
|
||||||
|
: MainPage(parent)
|
||||||
|
{
|
||||||
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
mAddDialog = NULL;
|
||||||
|
mAlbumSelected = NULL;
|
||||||
|
mPhotoSelected = NULL;
|
||||||
|
mSlideShow = NULL;
|
||||||
|
|
||||||
|
connect( ui.toolButton_NewAlbum, SIGNAL(clicked()), this, SLOT(OpenOrShowPhotoAddDialog()));
|
||||||
|
connect( ui.toolButton_EditAlbum, SIGNAL(clicked()), this, SLOT(OpenPhotoEditDialog()));
|
||||||
|
connect( ui.toolButton_SlideShow, SIGNAL(clicked()), this, SLOT(OpenSlideShow()));
|
||||||
|
|
||||||
|
QTimer *timer = new QTimer(this);
|
||||||
|
timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
|
||||||
|
timer->start(1000);
|
||||||
|
|
||||||
|
|
||||||
|
/* setup TokenQueue */
|
||||||
|
mPhotoQueue = new TokenQueue(rsPhoto, this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PhotoDialog::notifySelection(PhotoItem *item, int ptype)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::notifySelection() from : " << ptype << " " << item;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
switch(ptype)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case PHOTO_ITEM_TYPE_ALBUM:
|
||||||
|
notifyAlbumSelection(item);
|
||||||
|
break;
|
||||||
|
case PHOTO_ITEM_TYPE_PHOTO:
|
||||||
|
notifyPhotoSelection(item);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhotoDialog::notifyAlbumSelection(PhotoItem *item)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::notifyAlbumSelection() from : " << item;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
if (mAlbumSelected)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::notifyAlbumSelection() unselecting old one : " << mAlbumSelected;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
mAlbumSelected->setSelected(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
mAlbumSelected = item;
|
||||||
|
insertPhotosForSelectedAlbum();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PhotoDialog::notifyPhotoSelection(PhotoItem *item)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::notifyPhotoSelection() from : " << item;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
if (mPhotoSelected)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::notifyPhotoSelection() unselecting old one : " << mPhotoSelected;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
mPhotoSelected->setSelected(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
mPhotoSelected = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PhotoDialog::checkUpdate()
|
||||||
|
{
|
||||||
|
/* update */
|
||||||
|
if (!rsPhoto)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (rsPhoto->updated())
|
||||||
|
{
|
||||||
|
//insertAlbums();
|
||||||
|
requestAlbumList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************** New Photo Dialog ***************/
|
||||||
|
|
||||||
|
void PhotoDialog::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;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mAlbumSelected->mIsPhoto)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::OpenPhotoEditDialog() MAJOR ERROR!";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string albumId = mAlbumSelected->mAlbumDetails.mMeta.mGroupId;
|
||||||
|
|
||||||
|
if (mSlideShow)
|
||||||
|
{
|
||||||
|
mSlideShow->show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mSlideShow = new PhotoSlideShow(NULL);
|
||||||
|
mSlideShow->show();
|
||||||
|
}
|
||||||
|
mSlideShow->loadAlbum(albumId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************** New Photo Dialog ***************/
|
||||||
|
|
||||||
|
void PhotoDialog::OpenOrShowPhotoAddDialog()
|
||||||
|
{
|
||||||
|
if (mAddDialog)
|
||||||
|
{
|
||||||
|
mAddDialog->show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mAddDialog = new PhotoAddDialog(NULL);
|
||||||
|
mAddDialog->show();
|
||||||
|
}
|
||||||
|
mAddDialog->clearDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************** Edit Photo Dialog ***************/
|
||||||
|
|
||||||
|
void PhotoDialog::OpenPhotoEditDialog()
|
||||||
|
{
|
||||||
|
/* check if we have an album selected */
|
||||||
|
// THE TWO MessageBoxes - should be handled by disabling the Button!.
|
||||||
|
// 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 (mAlbumSelected->mIsPhoto)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::OpenPhotoEditDialog() MAJOR ERROR!";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string albumId = mAlbumSelected->mAlbumDetails.mMeta.mGroupId;
|
||||||
|
#if 0
|
||||||
|
uint32_t flags = mAlbumSelected->mAlbumDetails.mMeta.mGroupFlags;
|
||||||
|
|
||||||
|
if (!(flags & OWN))
|
||||||
|
{
|
||||||
|
// ALERT.
|
||||||
|
int ret = QMessageBox::information(this, tr("PhotoShare"),
|
||||||
|
tr("Cannot Edit Someone Else's Album"),
|
||||||
|
QMessageBox::Ok);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
OpenOrShowPhotoAddDialog();
|
||||||
|
mAddDialog->loadAlbum(albumId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool PhotoDialog::matchesAlbumFilter(const RsPhotoAlbum &album)
|
||||||
|
{
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
double PhotoDialog::AlbumScore(const RsPhotoAlbum &album)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool PhotoDialog::matchesPhotoFilter(const RsPhotoPhoto &photo)
|
||||||
|
{
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
double PhotoDialog::PhotoScore(const RsPhotoPhoto &photo)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhotoDialog::insertPhotosForSelectedAlbum()
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::insertPhotosForSelectedAlbum()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
clearPhotos();
|
||||||
|
|
||||||
|
//std::list<std::string> albumIds;
|
||||||
|
if (mAlbumSelected)
|
||||||
|
{
|
||||||
|
if (mAlbumSelected->mIsPhoto)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::insertPhotosForSelectedAlbum() MAJOR ERROR!";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string albumId = mAlbumSelected->mAlbumDetails.mMeta.mGroupId;
|
||||||
|
//albumIds.push_back(albumId);
|
||||||
|
|
||||||
|
std::cerr << "PhotoDialog::insertPhotosForSelectedAlbum() AlbumId: " << albumId;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
requestPhotoList(albumId);
|
||||||
|
}
|
||||||
|
//requestPhotoList(albumIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PhotoDialog::clearAlbums()
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::clearAlbums()" << std::endl;
|
||||||
|
|
||||||
|
std::list<PhotoItem *> photoItems;
|
||||||
|
std::list<PhotoItem *>::iterator pit;
|
||||||
|
|
||||||
|
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||||
|
int count = alayout->count();
|
||||||
|
for(int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
QLayoutItem *litem = alayout->itemAt(i);
|
||||||
|
if (!litem)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::clearAlbums() missing litem";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
PhotoItem *item = dynamic_cast<PhotoItem *>(litem->widget());
|
||||||
|
if (item)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::clearAlbums() item: " << item;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
photoItems.push_back(item);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::clearAlbums() Found Child, which is not a PhotoItem???";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(pit = photoItems.begin(); pit != photoItems.end(); pit++)
|
||||||
|
{
|
||||||
|
PhotoItem *item = *pit;
|
||||||
|
alayout->removeWidget(item);
|
||||||
|
delete item;
|
||||||
|
}
|
||||||
|
mAlbumSelected = NULL;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhotoDialog::clearPhotos()
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::clearPhotos()" << std::endl;
|
||||||
|
|
||||||
|
std::list<PhotoItem *> photoItems;
|
||||||
|
std::list<PhotoItem *>::iterator pit;
|
||||||
|
|
||||||
|
QLayout *alayout = ui.scrollAreaWidgetContents_2->layout();
|
||||||
|
int count = alayout->count();
|
||||||
|
for(int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
QLayoutItem *litem = alayout->itemAt(i);
|
||||||
|
if (!litem)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::clearPhotos() missing litem";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
PhotoItem *item = dynamic_cast<PhotoItem *>(litem->widget());
|
||||||
|
if (item)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::clearPhotos() item: " << item;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
photoItems.push_back(item);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::clearPhotos() Found Child, which is not a PhotoItem???";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(pit = photoItems.begin(); pit != photoItems.end(); pit++)
|
||||||
|
{
|
||||||
|
PhotoItem *item = *pit;
|
||||||
|
alayout->removeWidget(item);
|
||||||
|
delete item;
|
||||||
|
}
|
||||||
|
|
||||||
|
mPhotoSelected = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhotoDialog::addAlbum(const RsPhotoAlbum &album)
|
||||||
|
{
|
||||||
|
std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl;
|
||||||
|
|
||||||
|
PhotoItem *item = new PhotoItem(this, album);
|
||||||
|
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||||
|
alayout->addWidget(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PhotoDialog::addPhoto(const RsPhotoPhoto &photo)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::addPhoto() AlbumId: " << photo.mMeta.mGroupId;
|
||||||
|
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
RsPhotoAlbum dummyAlbum;
|
||||||
|
dummyAlbum.mSetFlags = 0;
|
||||||
|
|
||||||
|
PhotoItem *item = new PhotoItem(this, photo, dummyAlbum);
|
||||||
|
QLayout *alayout = ui.scrollAreaWidgetContents_2->layout();
|
||||||
|
alayout->addWidget(item);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhotoDialog::deletePhotoItem(PhotoItem *item, uint32_t type)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**************************** Request / Response Filling of Data ************************/
|
||||||
|
|
||||||
|
|
||||||
|
void PhotoDialog::requestAlbumList()
|
||||||
|
{
|
||||||
|
|
||||||
|
std::list<std::string> ids;
|
||||||
|
RsTokReqOptions opts;
|
||||||
|
uint32_t token;
|
||||||
|
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PhotoDialog::loadAlbumList(const uint32_t &token)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::loadAlbumList()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
std::list<std::string> albumIds;
|
||||||
|
rsPhoto->getGroupList(token, albumIds);
|
||||||
|
|
||||||
|
requestAlbumData(albumIds);
|
||||||
|
|
||||||
|
clearPhotos();
|
||||||
|
|
||||||
|
std::list<std::string>::iterator it;
|
||||||
|
for(it = albumIds.begin(); it != albumIds.end(); it++)
|
||||||
|
{
|
||||||
|
requestPhotoList(*it);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PhotoDialog::requestAlbumData(const std::list<std::string> &ids)
|
||||||
|
{
|
||||||
|
RsTokReqOptions opts;
|
||||||
|
uint32_t token;
|
||||||
|
mPhotoQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, ids, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool PhotoDialog::loadAlbumData(const uint32_t &token)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::loadAlbumData()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
clearAlbums();
|
||||||
|
|
||||||
|
bool moreData = true;
|
||||||
|
while(moreData)
|
||||||
|
{
|
||||||
|
RsPhotoAlbum album;
|
||||||
|
if (rsPhoto->getAlbum(token, album))
|
||||||
|
{
|
||||||
|
std::cerr << " PhotoDialog::addAlbum() AlbumId: " << album.mMeta.mGroupId << std::endl;
|
||||||
|
|
||||||
|
PhotoItem *item = new PhotoItem(this, album);
|
||||||
|
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||||
|
alayout->addWidget(item);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
moreData = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PhotoDialog::requestPhotoList(const std::string &albumId)
|
||||||
|
{
|
||||||
|
|
||||||
|
std::list<std::string> ids;
|
||||||
|
ids.push_back(albumId);
|
||||||
|
RsTokReqOptions opts;
|
||||||
|
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
||||||
|
uint32_t token;
|
||||||
|
mPhotoQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_LIST, opts, ids, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void PhotoDialog::loadPhotoList(const uint32_t &token)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::loadPhotoList()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
std::list<std::string> photoIds;
|
||||||
|
|
||||||
|
rsPhoto->getMsgList(token, photoIds);
|
||||||
|
requestPhotoData(photoIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PhotoDialog::requestPhotoData(const std::list<std::string> &photoIds)
|
||||||
|
{
|
||||||
|
RsTokReqOptions opts;
|
||||||
|
uint32_t token;
|
||||||
|
mPhotoQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, photoIds, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PhotoDialog::loadPhotoData(const uint32_t &token)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::loadPhotoData()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
bool moreData = true;
|
||||||
|
while(moreData)
|
||||||
|
{
|
||||||
|
RsPhotoPhoto photo;
|
||||||
|
|
||||||
|
if (rsPhoto->getPhoto(token, photo))
|
||||||
|
{
|
||||||
|
|
||||||
|
std::cerr << "PhotoDialog::loadPhotoData() AlbumId: " << photo.mMeta.mGroupId;
|
||||||
|
std::cerr << " PhotoId: " << photo.mMeta.mMsgId;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
addPhoto(photo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
moreData = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/********************************/
|
||||||
|
|
||||||
|
void PhotoDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||||
|
{
|
||||||
|
std::cerr << "PhotoDialog::loadRequest()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
if (queue == mPhotoQueue)
|
||||||
|
{
|
||||||
|
/* now switch on req */
|
||||||
|
switch(req.mType)
|
||||||
|
{
|
||||||
|
case TOKENREQ_GROUPINFO:
|
||||||
|
switch(req.mAnsType)
|
||||||
|
{
|
||||||
|
case RS_TOKREQ_ANSTYPE_LIST:
|
||||||
|
loadAlbumList(req.mToken);
|
||||||
|
break;
|
||||||
|
case RS_TOKREQ_ANSTYPE_DATA:
|
||||||
|
loadAlbumData(req.mToken);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
std::cerr << "PhotoDialog::loadRequest() ERROR: GROUP: INVALID ANS TYPE";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TOKENREQ_MSGINFO:
|
||||||
|
switch(req.mAnsType)
|
||||||
|
{
|
||||||
|
case RS_TOKREQ_ANSTYPE_LIST:
|
||||||
|
loadPhotoList(req.mToken);
|
||||||
|
break;
|
||||||
|
//case RS_TOKREQ_ANSTYPE_DATA:
|
||||||
|
// loadPhotoData(req.mToken);
|
||||||
|
// break;
|
||||||
|
default:
|
||||||
|
std::cerr << "PhotoDialog::loadRequest() ERROR: MSG: INVALID ANS TYPE";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TOKENREQ_MSGRELATEDINFO:
|
||||||
|
switch(req.mAnsType)
|
||||||
|
{
|
||||||
|
case RS_TOKREQ_ANSTYPE_DATA:
|
||||||
|
loadPhotoData(req.mToken);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
std::cerr << "PhotoDialog::loadRequest() ERROR: MSG: INVALID ANS TYPE";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
std::cerr << "PhotoDialog::loadRequest() ERROR: INVALID TYPE";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**************************** Request / Response Filling of Data ************************/
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
68
retroshare-gui/src/gui/Posted/PostedDialog.h
Normal file
68
retroshare-gui/src/gui/Posted/PostedDialog.h
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* Retroshare Posted Dialog
|
||||||
|
*
|
||||||
|
* Copyright 2012-2012 by Robert Fernie.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License Version 2.1 as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
|
* USA.
|
||||||
|
*
|
||||||
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MRK_POSTED_DIALOG_H
|
||||||
|
#define MRK_POSTED_DIALOG_H
|
||||||
|
|
||||||
|
#include "gui/mainpage.h"
|
||||||
|
#include "ui_PostedDialog.h"
|
||||||
|
|
||||||
|
#include <retroshare/rsposted.h>
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
//#include "gui/Posted/PostedList.h"
|
||||||
|
//#include "gui/Posted/PostedComments.h"
|
||||||
|
|
||||||
|
//#include "gui/PhotoShare/PhotoAddDialog.h"
|
||||||
|
//#include "gui/PhotoShare/PhotoSlideShow.h"
|
||||||
|
//#include "util/TokenQueue.h"
|
||||||
|
|
||||||
|
class PostedListDialog;
|
||||||
|
class PostedComments;
|
||||||
|
|
||||||
|
class PostedDialog : public MainPage
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
PostedDialog(QWidget *parent = 0);
|
||||||
|
|
||||||
|
//virtual void addTab(std::string item);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
//void OpenSlideShow();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
PostedListDialog *mPostedList;
|
||||||
|
PostedComments *mPostedComments;
|
||||||
|
|
||||||
|
/* UI - from Designer */
|
||||||
|
Ui::PostedDialog ui;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
33
retroshare-gui/src/gui/Posted/PostedDialog.ui
Normal file
33
retroshare-gui/src/gui/Posted/PostedDialog.ui
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>PostedDialog</class>
|
||||||
|
<widget class="QWidget" name="PostedDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>726</width>
|
||||||
|
<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>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
299
retroshare-gui/src/gui/Posted/PostedItem.cpp
Normal file
299
retroshare-gui/src/gui/Posted/PostedItem.cpp
Normal file
@ -0,0 +1,299 @@
|
|||||||
|
/*
|
||||||
|
* Retroshare Posted Plugin.
|
||||||
|
*
|
||||||
|
* Copyright 2012-2012 by Robert Fernie.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License Version 2.1 as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
|
* USA.
|
||||||
|
*
|
||||||
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <QDateTime>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
#include <QBuffer>
|
||||||
|
|
||||||
|
#include "PostedItem.h"
|
||||||
|
|
||||||
|
#include <retroshare/rsposted.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
/****
|
||||||
|
* #define DEBUG_ITEM 1
|
||||||
|
****/
|
||||||
|
|
||||||
|
/** Constructor */
|
||||||
|
PostedItem::PostedItem(PostedHolder *parent, const RsPostedPost &post)
|
||||||
|
:QWidget(NULL)
|
||||||
|
{
|
||||||
|
setupUi(this);
|
||||||
|
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||||
|
|
||||||
|
titleLabel->setText(QString::fromUtf8(post.mMeta.mMsgName.c_str()));
|
||||||
|
dateLabel->setText(QString("Whenever"));
|
||||||
|
fromLabel->setText(QString::fromUtf8(post.mMeta.mAuthorId.c_str()));
|
||||||
|
siteLabel->setText(QString::fromUtf8(post.mMeta.mAuthorId.c_str()));
|
||||||
|
scoreLabel->setText(QString("1140"));
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#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
|
65
retroshare-gui/src/gui/Posted/PostedItem.h
Normal file
65
retroshare-gui/src/gui/Posted/PostedItem.h
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* Retroshare Posted Plugin.
|
||||||
|
*
|
||||||
|
* Copyright 2012-2012 by Robert Fernie.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License Version 2.1 as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
|
* USA.
|
||||||
|
*
|
||||||
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MRK_POSTED_POSTED_ITEM_H
|
||||||
|
#define MRK_POSTED_POSTED_ITEM_H
|
||||||
|
|
||||||
|
#include "ui_PostedItem.h"
|
||||||
|
|
||||||
|
#include <retroshare/rsposted.h>
|
||||||
|
|
||||||
|
class RsPostedPost;
|
||||||
|
class PostedItem;
|
||||||
|
|
||||||
|
class PostedHolder
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void deletePostedItem(PostedItem *, uint32_t ptype) = 0;
|
||||||
|
virtual void notifySelection(PostedItem *item, int ptype) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class PostedItem : public QWidget, private Ui::PostedItem
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
PostedItem(PostedHolder *parent, const RsPostedPost &item);
|
||||||
|
|
||||||
|
//void setDummyText();
|
||||||
|
//void updateParent(PhotoHolder *parent); // for external construction.
|
||||||
|
//void removeItem();
|
||||||
|
|
||||||
|
//void setSelected(bool on);
|
||||||
|
//bool isSelected();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//void mousePressEvent(QMouseEvent *event);
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint32_t mType;
|
||||||
|
bool mSelected;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
285
retroshare-gui/src/gui/Posted/PostedItem.ui
Normal file
285
retroshare-gui/src/gui/Posted/PostedItem.ui
Normal file
@ -0,0 +1,285 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>PostedItem</class>
|
||||||
|
<widget class="QWidget" name="PostedItem">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>638</width>
|
||||||
|
<height>177</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout">
|
||||||
|
<property name="margin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QFrame" name="frame">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QFrame#frame{border: 2px solid #CCCCCC;
|
||||||
|
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||||
|
stop: 0 #EEEEEE, stop: 1 #CCCCCC);
|
||||||
|
border-radius: 10px}</string>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,1">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="scoreLabel">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>20</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>1</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButton_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>/\</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>score</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>\/</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="titleLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>12</pointsize>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Title this is a very very very very loooooooooooooooonnnnnnnnnnnnnnnnng title dont you think? yes it is and should wrap around I hope</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="openExternalLinks">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="dateBoldLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Date</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="dateLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">You eyes only</string>
|
||||||
|
</property>
|
||||||
|
<property name="openExternalLinks">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="fromBoldLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>From</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="fromLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">Signed by</string>
|
||||||
|
</property>
|
||||||
|
<property name="openExternalLinks">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="fromBoldLabel_2">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Site</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="siteLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>9</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">Signed by</string>
|
||||||
|
</property>
|
||||||
|
<property name="openExternalLinks">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="1,0">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>288</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>View Comments</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="../../retroshare-gui/src/gui/images.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
511
retroshare-gui/src/gui/Posted/PostedListDialog.cpp
Normal file
511
retroshare-gui/src/gui/Posted/PostedListDialog.cpp
Normal file
@ -0,0 +1,511 @@
|
|||||||
|
/*
|
||||||
|
* Retroshare Posted List
|
||||||
|
*
|
||||||
|
* Copyright 2012-2012 by Robert Fernie.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License Version 2.1 as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
|
* USA.
|
||||||
|
*
|
||||||
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "PostedListDialog.h"
|
||||||
|
|
||||||
|
//#include <retroshare/rspeers.h>
|
||||||
|
#include <retroshare/rsposted.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
/****************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
//#define DEBUG_FORUMS
|
||||||
|
|
||||||
|
/* Images for context menu icons */
|
||||||
|
#define IMAGE_MESSAGE ":/images/folder-draft.png"
|
||||||
|
#define IMAGE_MESSAGEREPLY ":/images/mail_reply.png"
|
||||||
|
#define IMAGE_MESSAGEREMOVE ":/images/mail_delete.png"
|
||||||
|
#define IMAGE_DOWNLOAD ":/images/start.png"
|
||||||
|
#define IMAGE_DOWNLOADALL ":/images/startall.png"
|
||||||
|
|
||||||
|
/* Images for TreeWidget */
|
||||||
|
#define IMAGE_FOLDER ":/images/folder16.png"
|
||||||
|
#define IMAGE_FOLDERGREEN ":/images/folder_green.png"
|
||||||
|
#define IMAGE_FOLDERRED ":/images/folder_red.png"
|
||||||
|
#define IMAGE_FOLDERYELLOW ":/images/folder_yellow.png"
|
||||||
|
#define IMAGE_FORUM ":/images/konversation16.png"
|
||||||
|
#define IMAGE_SUBSCRIBE ":/images/edit_add24.png"
|
||||||
|
#define IMAGE_UNSUBSCRIBE ":/images/cancel.png"
|
||||||
|
#define IMAGE_INFO ":/images/info16.png"
|
||||||
|
#define IMAGE_NEWFORUM ":/images/new_forum16.png"
|
||||||
|
#define IMAGE_FORUMAUTHD ":/images/konv_message2.png"
|
||||||
|
#define IMAGE_COPYLINK ":/images/copyrslink.png"
|
||||||
|
|
||||||
|
/** Constructor */
|
||||||
|
PostedListDialog::PostedListDialog(QWidget *parent)
|
||||||
|
: RsAutoUpdatePage(1000,parent)
|
||||||
|
{
|
||||||
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
/* Setup Queue */
|
||||||
|
mPostedQueue = new TokenQueue(rsPosted, this);
|
||||||
|
|
||||||
|
connect( ui.groupTreeWidget, SIGNAL( treeCustomContextMenuRequested( QPoint ) ), this, SLOT( groupListCustomPopupMenu( QPoint ) ) );
|
||||||
|
|
||||||
|
connect( ui.groupTreeWidget, SIGNAL( treeCurrentItemChanged(QString) ), this, SLOT( changedTopic(QString) ) );
|
||||||
|
|
||||||
|
/* Initialize group tree */
|
||||||
|
//ui.groupTreeWidget->initDisplayMenu(ui.displayButton);
|
||||||
|
|
||||||
|
/* create forum tree */
|
||||||
|
yourTopics = ui.groupTreeWidget->addCategoryItem(tr("Your Topics"), QIcon(IMAGE_FOLDER), true);
|
||||||
|
subscribedTopics = ui.groupTreeWidget->addCategoryItem(tr("Subscribed Topics"), QIcon(IMAGE_FOLDERRED), true);
|
||||||
|
popularTopics = ui.groupTreeWidget->addCategoryItem(tr("Popular Topics"), QIcon(IMAGE_FOLDERGREEN), false);
|
||||||
|
otherTopics = ui.groupTreeWidget->addCategoryItem(tr("Other Topics"), QIcon(IMAGE_FOLDERYELLOW), false);
|
||||||
|
|
||||||
|
/* Hide platform specific features */
|
||||||
|
#ifdef Q_WS_WIN
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PostedListDialog::groupListCustomPopupMenu( QPoint /*point*/ )
|
||||||
|
{
|
||||||
|
QMenu contextMnu( this );
|
||||||
|
|
||||||
|
QAction *action = contextMnu.addAction(QIcon(IMAGE_SUBSCRIBE), tr("Subscribe to Forum"), this, SLOT(subscribeToForum()));
|
||||||
|
//action->setDisabled (mCurrTopicId.empty() || IS_FORUM_SUBSCRIBED(subscribeFlags));
|
||||||
|
|
||||||
|
action = contextMnu.addAction(QIcon(IMAGE_UNSUBSCRIBE), tr("Unsubscribe to Forum"), this, SLOT(unsubscribeToForum()));
|
||||||
|
//action->setEnabled (!mCurrTopicId.empty() && IS_FORUM_SUBSCRIBED(subscribeFlags));
|
||||||
|
|
||||||
|
contextMnu.addSeparator();
|
||||||
|
|
||||||
|
contextMnu.addAction(QIcon(IMAGE_NEWFORUM), tr("New Forum"), this, SLOT(newforum()));
|
||||||
|
|
||||||
|
action = contextMnu.addAction(QIcon(IMAGE_INFO), tr("Show Forum Details"), this, SLOT(showForumDetails()));
|
||||||
|
action->setEnabled (!mCurrTopicId.empty ());
|
||||||
|
|
||||||
|
action = contextMnu.addAction(QIcon(":/images/settings16.png"), tr("Edit Forum Details"), this, SLOT(editForumDetails()));
|
||||||
|
//action->setEnabled (!mCurrTopicId.empty () && IS_FORUM_ADMIN(subscribeFlags));
|
||||||
|
|
||||||
|
QAction *shareKeyAct = new QAction(QIcon(":/images/gpgp_key_generate.png"), tr("Share Forum"), &contextMnu);
|
||||||
|
connect( shareKeyAct, SIGNAL( triggered() ), this, SLOT( shareKey() ) );
|
||||||
|
//shareKeyAct->setEnabled(!mCurrTopicId.empty() && IS_FORUM_ADMIN(subscribeFlags));
|
||||||
|
contextMnu.addAction( shareKeyAct);
|
||||||
|
|
||||||
|
QAction *restoreKeysAct = new QAction(QIcon(":/images/settings16.png"), tr("Restore Publish Rights for Forum" ), &contextMnu);
|
||||||
|
connect( restoreKeysAct , SIGNAL( triggered() ), this, SLOT( restoreForumKeys() ) );
|
||||||
|
//restoreKeysAct->setEnabled(!mCurrTopicId.empty() && !IS_FORUM_ADMIN(subscribeFlags));
|
||||||
|
contextMnu.addAction( restoreKeysAct);
|
||||||
|
|
||||||
|
action = contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyForumLink()));
|
||||||
|
action->setEnabled(!mCurrTopicId.empty());
|
||||||
|
|
||||||
|
contextMnu.addSeparator();
|
||||||
|
|
||||||
|
action = contextMnu.addAction(QIcon(":/images/message-mail-read.png"), tr("Mark all as read"), this, SLOT(markMsgAsReadAll()));
|
||||||
|
//action->setEnabled (!mCurrTopicId.empty () && IS_FORUM_SUBSCRIBED(subscribeFlags));
|
||||||
|
|
||||||
|
action = contextMnu.addAction(QIcon(":/images/message-mail.png"), tr("Mark all as unread"), this, SLOT(markMsgAsUnreadAll()));
|
||||||
|
//action->setEnabled (!mCurrTopicId.empty () && IS_FORUM_SUBSCRIBED(subscribeFlags));
|
||||||
|
|
||||||
|
#ifdef DEBUG_FORUMS
|
||||||
|
contextMnu.addSeparator();
|
||||||
|
action = contextMnu.addAction("Generate mass data", this, SLOT(generateMassData()));
|
||||||
|
action->setEnabled (!mCurrTopicId.empty() && IS_FORUM_SUBSCRIBED(subscribeFlags));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
contextMnu.exec(QCursor::pos());
|
||||||
|
}
|
||||||
|
|
||||||
|
void PostedListDialog::updateDisplay()
|
||||||
|
{
|
||||||
|
std::list<std::string> groupIds;
|
||||||
|
std::list<std::string>::iterator it;
|
||||||
|
if (!rsPosted)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// TODO groupsChanged... HACK XXX.
|
||||||
|
if ((rsPosted->groupsChanged(groupIds)) || (rsPosted->updated()))
|
||||||
|
{
|
||||||
|
/* update Forums List */
|
||||||
|
insertGroups();
|
||||||
|
|
||||||
|
it = std::find(groupIds.begin(), groupIds.end(), mCurrTopicId);
|
||||||
|
if (it != groupIds.end())
|
||||||
|
{
|
||||||
|
/* update threads as well */
|
||||||
|
insertThreads();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PostedListDialog::changedTopic(const QString &id)
|
||||||
|
{
|
||||||
|
mCurrTopicId = id.toStdString();
|
||||||
|
insertThreads();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*********************** **** **** **** ***********************/
|
||||||
|
/** Request / Response of Data ********************************/
|
||||||
|
/*********************** **** **** **** ***********************/
|
||||||
|
|
||||||
|
#define POSTEDDIALOG_LISTING 1
|
||||||
|
#define POSTEDDIALOG_CURRENTFORUM 2
|
||||||
|
#define POSTEDDIALOG_INSERTTHREADS 3
|
||||||
|
#define POSTEDDIALOG_INSERTCHILD 4
|
||||||
|
#define POSTEDDIALOG_INSERT_POST 5
|
||||||
|
#define POSTEDDIALOG_REPLY_MESSAGE 6
|
||||||
|
|
||||||
|
|
||||||
|
void PostedListDialog::insertGroups()
|
||||||
|
{
|
||||||
|
requestGroupSummary();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PostedListDialog::requestGroupSummary()
|
||||||
|
{
|
||||||
|
std::cerr << "PostedListDialog::requestGroupSummary()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
std::list<std::string> ids;
|
||||||
|
RsTokReqOptions opts;
|
||||||
|
uint32_t token;
|
||||||
|
mPostedQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, ids, POSTEDDIALOG_LISTING);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PostedListDialog::loadGroupSummary(const uint32_t &token)
|
||||||
|
{
|
||||||
|
std::cerr << "PostedListDialog::loadGroupSummary()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
std::list<RsGroupMetaData> groupInfo;
|
||||||
|
rsPosted->getGroupSummary(token, groupInfo);
|
||||||
|
|
||||||
|
if (groupInfo.size() > 0)
|
||||||
|
{
|
||||||
|
insertGroupData(groupInfo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "PostedListDialog::loadGroupSummary() ERROR No Groups...";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*********************** **** **** **** ***********************/
|
||||||
|
/*********************** **** **** **** ***********************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void PostedListDialog::requestGroupSummary_CurrentForum(const std::string &forumId)
|
||||||
|
{
|
||||||
|
RsTokReqOptions opts;
|
||||||
|
|
||||||
|
std::list<std::string> grpIds;
|
||||||
|
grpIds.push_back(forumId);
|
||||||
|
|
||||||
|
std::cerr << "PostedListDialog::requestGroupSummary_CurrentForum(" << forumId << ")";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
uint32_t token;
|
||||||
|
mPostedQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, grpIds, POSTEDDIALOG_CURRENTFORUM);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PostedListDialog::loadGroupSummary_CurrentForum(const uint32_t &token)
|
||||||
|
{
|
||||||
|
std::cerr << "PostedListDialog::loadGroupSummary_CurrentForum()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
std::list<RsGroupMetaData> groupInfo;
|
||||||
|
rsPosted->getGroupSummary(token, groupInfo);
|
||||||
|
|
||||||
|
if (groupInfo.size() == 1)
|
||||||
|
{
|
||||||
|
RsGroupMetaData fi = groupInfo.front();
|
||||||
|
//insertForumThreads(fi);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "PostedListDialog::loadGroupSummary_CurrentForum() ERROR Invalid Number of Groups...";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*********************** **** **** **** ***********************/
|
||||||
|
/*********************** **** **** **** ***********************/
|
||||||
|
/*********************** **** **** **** ***********************/
|
||||||
|
/*********************** **** **** **** ***********************/
|
||||||
|
|
||||||
|
|
||||||
|
void PostedListDialog::insertThreads()
|
||||||
|
{
|
||||||
|
loadCurrentForumThreads(mCurrTopicId);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PostedListDialog::loadCurrentForumThreads(const std::string &forumId)
|
||||||
|
{
|
||||||
|
|
||||||
|
std::cerr << "PostedListDialog::loadCurrentForumThreads(" << forumId << ")";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
/* if already active -> kill current loading */
|
||||||
|
if (mThreadLoading)
|
||||||
|
{
|
||||||
|
/* Cleanup */
|
||||||
|
}
|
||||||
|
|
||||||
|
clearPosts();
|
||||||
|
|
||||||
|
/* initiate loading */
|
||||||
|
std::cerr << "PostedListDialog::loadCurrentForumThreads() Initiating Loading";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
mThreadLoading = true;
|
||||||
|
|
||||||
|
requestGroupThreadData_InsertThreads(forumId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void PostedListDialog::requestGroupThreadData_InsertThreads(const std::string &forumId)
|
||||||
|
{
|
||||||
|
RsTokReqOptions opts;
|
||||||
|
|
||||||
|
opts.mOptions = RS_TOKREQOPT_MSG_THREAD | RS_TOKREQOPT_MSG_LATEST;
|
||||||
|
|
||||||
|
std::list<std::string> grpIds;
|
||||||
|
grpIds.push_back(forumId);
|
||||||
|
|
||||||
|
std::cerr << "PostedListDialog::requestGroupThreadData_InsertThreads(" << forumId << ")";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
uint32_t token;
|
||||||
|
mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, POSTEDDIALOG_INSERTTHREADS);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PostedListDialog::loadGroupThreadData_InsertThreads(const uint32_t &token)
|
||||||
|
{
|
||||||
|
std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
bool moreData = true;
|
||||||
|
while(moreData)
|
||||||
|
{
|
||||||
|
RsPostedPost post;
|
||||||
|
if (rsPosted->getPost(token, post))
|
||||||
|
{
|
||||||
|
std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads() MsgId: " << post.mMeta.mMsgId;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
loadPost(post);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
moreData = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mThreadLoading = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PostedListDialog::loadPost(const RsPostedPost &post)
|
||||||
|
{
|
||||||
|
PostedItem *item = new PostedItem(this, post);
|
||||||
|
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||||
|
alayout->addWidget(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PostedListDialog::clearPosts()
|
||||||
|
{
|
||||||
|
std::cerr << "PostedListDialog::clearPosts()" << std::endl;
|
||||||
|
|
||||||
|
std::list<PostedItem *> postedItems;
|
||||||
|
std::list<PostedItem *>::iterator pit;
|
||||||
|
|
||||||
|
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||||
|
int count = alayout->count();
|
||||||
|
for(int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
QLayoutItem *litem = alayout->itemAt(i);
|
||||||
|
if (!litem)
|
||||||
|
{
|
||||||
|
std::cerr << "PostedListDialog::clearPosts() missing litem";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
PostedItem *item = dynamic_cast<PostedItem *>(litem->widget());
|
||||||
|
if (item)
|
||||||
|
{
|
||||||
|
std::cerr << "PostedListDialog::clearPosts() item: " << item;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
postedItems.push_back(item);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "PostedListDialog::clearPosts() Found Child, which is not a PostedItem???";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(pit = postedItems.begin(); pit != postedItems.end(); pit++)
|
||||||
|
{
|
||||||
|
PostedItem *item = *pit;
|
||||||
|
alayout->removeWidget(item);
|
||||||
|
delete item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*********************** **** **** **** ***********************/
|
||||||
|
/*********************** **** **** **** ***********************/
|
||||||
|
/*********************** **** **** **** ***********************/
|
||||||
|
|
||||||
|
void PostedListDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||||
|
{
|
||||||
|
std::cerr << "PostedListDialog::loadRequest() UserType: " << req.mUserType;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
if (queue == mPostedQueue)
|
||||||
|
{
|
||||||
|
/* now switch on req */
|
||||||
|
switch(req.mUserType)
|
||||||
|
{
|
||||||
|
case POSTEDDIALOG_LISTING:
|
||||||
|
loadGroupSummary(req.mToken);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case POSTEDDIALOG_CURRENTFORUM:
|
||||||
|
loadGroupSummary_CurrentForum(req.mToken);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case POSTEDDIALOG_INSERTTHREADS:
|
||||||
|
loadGroupThreadData_InsertThreads(req.mToken);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
std::cerr << "PostedListDialog::loadRequest() ERROR: INVALID TYPE";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************************/
|
||||||
|
/**************************************************************************************/
|
||||||
|
/**************************************************************************************/
|
||||||
|
/**************************** Groups **********************/
|
||||||
|
|
||||||
|
|
||||||
|
void PostedListDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo)
|
||||||
|
{
|
||||||
|
|
||||||
|
groupItemInfo.id = QString::fromStdString(groupInfo.mGroupId);
|
||||||
|
groupItemInfo.name = QString::fromUtf8(groupInfo.mGroupName.c_str());
|
||||||
|
//groupItemInfo.description = QString::fromUtf8(groupInfo.forumDesc);
|
||||||
|
groupItemInfo.popularity = groupInfo.mPop;
|
||||||
|
groupItemInfo.lastpost = QDateTime::fromTime_t(groupInfo.mLastPost);
|
||||||
|
|
||||||
|
if (groupInfo.mGroupFlags & RS_DISTRIB_AUTHEN_REQ) {
|
||||||
|
groupItemInfo.name += " (" + tr("AUTHD") + ")";
|
||||||
|
groupItemInfo.icon = QIcon(IMAGE_FORUMAUTHD);
|
||||||
|
} else {
|
||||||
|
groupItemInfo.icon = QIcon(IMAGE_FORUM);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PostedListDialog::insertGroupData(const std::list<RsGroupMetaData> &groupList)
|
||||||
|
{
|
||||||
|
std::list<RsGroupMetaData>::const_iterator it;
|
||||||
|
|
||||||
|
QList<GroupItemInfo> adminList;
|
||||||
|
QList<GroupItemInfo> subList;
|
||||||
|
QList<GroupItemInfo> popList;
|
||||||
|
QList<GroupItemInfo> otherList;
|
||||||
|
std::multimap<uint32_t, GroupItemInfo> popMap;
|
||||||
|
|
||||||
|
for (it = groupList.begin(); it != groupList.end(); it++) {
|
||||||
|
/* sort it into Publish (Own), Subscribed, Popular and Other */
|
||||||
|
uint32_t flags = it->mSubscribeFlags;
|
||||||
|
|
||||||
|
GroupItemInfo groupItemInfo;
|
||||||
|
groupInfoToGroupItemInfo(*it, groupItemInfo);
|
||||||
|
|
||||||
|
if (flags & RS_DISTRIB_ADMIN) {
|
||||||
|
adminList.push_back(groupItemInfo);
|
||||||
|
} else if (flags & RS_DISTRIB_SUBSCRIBED) {
|
||||||
|
/* subscribed forum */
|
||||||
|
subList.push_back(groupItemInfo);
|
||||||
|
} else {
|
||||||
|
/* rate the others by popularity */
|
||||||
|
popMap.insert(std::make_pair(it->mPop, groupItemInfo));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* iterate backwards through popMap - take the top 5 or 10% of list */
|
||||||
|
uint32_t popCount = 5;
|
||||||
|
if (popCount < popMap.size() / 10)
|
||||||
|
{
|
||||||
|
popCount = popMap.size() / 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t i = 0;
|
||||||
|
uint32_t popLimit = 0;
|
||||||
|
std::multimap<uint32_t, GroupItemInfo>::reverse_iterator rit;
|
||||||
|
for(rit = popMap.rbegin(); ((rit != popMap.rend()) && (i < popCount)); rit++, i++) ;
|
||||||
|
if (rit != popMap.rend()) {
|
||||||
|
popLimit = rit->first;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (rit = popMap.rbegin(); rit != popMap.rend(); rit++) {
|
||||||
|
if (rit->second.popularity < (int) popLimit) {
|
||||||
|
otherList.append(rit->second);
|
||||||
|
} else {
|
||||||
|
popList.append(rit->second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* now we can add them in as a tree! */
|
||||||
|
ui.groupTreeWidget->fillGroupItems(yourTopics, adminList);
|
||||||
|
ui.groupTreeWidget->fillGroupItems(subscribedTopics, subList);
|
||||||
|
ui.groupTreeWidget->fillGroupItems(popularTopics, popList);
|
||||||
|
ui.groupTreeWidget->fillGroupItems(otherTopics, otherList);
|
||||||
|
|
||||||
|
// updateMessageSummaryList("");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************************/
|
||||||
|
/**************************************************************************************/
|
||||||
|
/**************************************************************************************/
|
||||||
|
|
||||||
|
|
100
retroshare-gui/src/gui/Posted/PostedListDialog.h
Normal file
100
retroshare-gui/src/gui/Posted/PostedListDialog.h
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
/*
|
||||||
|
* Retroshare Posted List
|
||||||
|
*
|
||||||
|
* Copyright 2012-2012 by Robert Fernie.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License Version 2.1 as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
|
* USA.
|
||||||
|
*
|
||||||
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MRK_POSTED_LIST_DIALOG_H
|
||||||
|
#define MRK_POSTED_LIST_DIALOG_H
|
||||||
|
|
||||||
|
#include "gui/mainpage.h"
|
||||||
|
#include "ui_PostedListDialog.h"
|
||||||
|
|
||||||
|
#include <retroshare/rsposted.h>
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
#include "gui/Posted/PostedItem.h"
|
||||||
|
#include "gui/common/GroupTreeWidget.h"
|
||||||
|
|
||||||
|
#include "util/TokenQueue.h"
|
||||||
|
|
||||||
|
#include "gui/RsAutoUpdatePage.h"
|
||||||
|
|
||||||
|
class PostedListDialog : public RsAutoUpdatePage, public PostedHolder, public TokenResponse
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
PostedListDialog(QWidget *parent = 0);
|
||||||
|
|
||||||
|
virtual void deletePostedItem(PostedItem *, uint32_t ptype) { return; }
|
||||||
|
virtual void notifySelection(PostedItem *item, int ptype) { return; }
|
||||||
|
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
void groupListCustomPopupMenu( QPoint /*point*/ );
|
||||||
|
void changedTopic(const QString &id);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
void clearPosts();
|
||||||
|
|
||||||
|
void updateDisplay();
|
||||||
|
void loadPost(const RsPostedPost &post);
|
||||||
|
|
||||||
|
void insertGroups();
|
||||||
|
void requestGroupSummary();
|
||||||
|
void loadGroupSummary(const uint32_t &token);
|
||||||
|
|
||||||
|
void requestGroupSummary_CurrentForum(const std::string &forumId);
|
||||||
|
void loadGroupSummary_CurrentForum(const uint32_t &token);
|
||||||
|
|
||||||
|
void insertThreads();
|
||||||
|
void loadCurrentForumThreads(const std::string &forumId);
|
||||||
|
|
||||||
|
void requestGroupThreadData_InsertThreads(const std::string &forumId);
|
||||||
|
void loadGroupThreadData_InsertThreads(const uint32_t &token);
|
||||||
|
|
||||||
|
|
||||||
|
void insertGroupData(const std::list<RsGroupMetaData> &groupList);
|
||||||
|
void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo);
|
||||||
|
|
||||||
|
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||||
|
|
||||||
|
|
||||||
|
QTreeWidgetItem *yourTopics;
|
||||||
|
QTreeWidgetItem *subscribedTopics;
|
||||||
|
QTreeWidgetItem *popularTopics;
|
||||||
|
QTreeWidgetItem *otherTopics;
|
||||||
|
|
||||||
|
bool mThreadLoading;
|
||||||
|
std::string mCurrTopicId;
|
||||||
|
|
||||||
|
TokenQueue *mPostedQueue;
|
||||||
|
|
||||||
|
/* UI - from Designer */
|
||||||
|
Ui::PostedListDialog ui;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
228
retroshare-gui/src/gui/Posted/PostedListDialog.ui
Normal file
228
retroshare-gui/src/gui/Posted/PostedListDialog.ui
Normal file
@ -0,0 +1,228 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>PostedListDialog</class>
|
||||||
|
<widget class="QWidget" name="PostedListDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>792</width>
|
||||||
|
<height>426</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Hot</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>New</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Top</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Today</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Yesterday</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>This Week</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>This Month</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>This Year</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSplitter" name="splitter">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="layoutWidget">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QPushButton" name="pushButton_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>New Link Group</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QPushButton" name="pushButton_8">
|
||||||
|
<property name="text">
|
||||||
|
<string>Submit Post</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="3">
|
||||||
|
<widget class="GroupTreeWidget" name="groupTreeWidget" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="layoutWidget">
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Refresh</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Showing 1-100</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>Prev</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Next</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QScrollArea" name="scrollArea">
|
||||||
|
<property name="widgetResizable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>461</width>
|
||||||
|
<height>330</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Minimum</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>309</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>GroupTreeWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>gui/common/GroupTreeWidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -37,6 +37,7 @@
|
|||||||
#include "gui/TheWire/WireDialog.h"
|
#include "gui/TheWire/WireDialog.h"
|
||||||
#include "gui/Identity/IdDialog.h"
|
#include "gui/Identity/IdDialog.h"
|
||||||
#include "gui/ForumsV2Dialog.h"
|
#include "gui/ForumsV2Dialog.h"
|
||||||
|
#include "gui/Posted/PostedDialog.h"
|
||||||
|
|
||||||
//#include "GamesDialog.h"
|
//#include "GamesDialog.h"
|
||||||
//#include "CalDialog.h"
|
//#include "CalDialog.h"
|
||||||
@ -112,6 +113,11 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags)
|
|||||||
ui.stackPages->add(forumsV2Dialog = new ForumsV2Dialog(ui.stackPages),
|
ui.stackPages->add(forumsV2Dialog = new ForumsV2Dialog(ui.stackPages),
|
||||||
createPageAction(QIcon(IMAGE_FORUMSV2), tr("ForumsV2"), grp));
|
createPageAction(QIcon(IMAGE_FORUMSV2), tr("ForumsV2"), grp));
|
||||||
|
|
||||||
|
PostedDialog *postedDialog = NULL;
|
||||||
|
ui.stackPages->add(postedDialog = new PostedDialog(ui.stackPages),
|
||||||
|
createPageAction(QIcon(IMAGE_LIBRARY), tr("Posted Links"), grp));
|
||||||
|
|
||||||
|
|
||||||
/* Create the toolbar */
|
/* Create the toolbar */
|
||||||
ui.toolBar->addActions(grp->actions());
|
ui.toolBar->addActions(grp->actions());
|
||||||
ui.toolBar->addSeparator();
|
ui.toolBar->addSeparator();
|
||||||
|
Loading…
Reference in New Issue
Block a user