GxsChannels:

- cleaned source code
- added auto refresh
- added todo button
- removed some debug output
Updated english translation

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6517 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2013-07-19 09:48:51 +00:00
parent 2b9a211184
commit 9c40fb878f
22 changed files with 429 additions and 545 deletions

View file

@ -92,7 +92,7 @@ void CirclesDialog::todo()
"</ul>"); "</ul>");
} }
void CirclesDialog::updateDisplay(bool /*initialFill*/) void CirclesDialog::updateDisplay(bool /*complete*/)
{ {
reloadAll(); reloadAll();
} }

View file

@ -40,7 +40,7 @@ public:
void loadRequest(const TokenQueue *queue, const TokenRequest &req); void loadRequest(const TokenQueue *queue, const TokenRequest &req);
protected: protected:
virtual void updateDisplay(bool initialFill); virtual void updateDisplay(bool complete);
private slots: private slots:
void todo(); void todo();

View file

@ -505,7 +505,7 @@ void IdDialog::insertIdDetails(uint32_t token)
requestRepList(data.mMeta.mGroupId); requestRepList(data.mMeta.mGroupId);
} }
void IdDialog::updateDisplay(bool /*initialFill*/) void IdDialog::updateDisplay(bool /*complete*/)
{ {
/* Update identity list */ /* Update identity list */
requestIdList(); requestIdList();

View file

@ -46,7 +46,7 @@ public:
void loadRequest(const TokenQueue *queue, const TokenRequest &req); void loadRequest(const TokenQueue *queue, const TokenRequest &req);
protected: protected:
virtual void updateDisplay(bool initialFill); virtual void updateDisplay(bool complete);
private slots: private slots:
void filterComboBoxChanged(); void filterComboBoxChanged();

View file

@ -291,7 +291,7 @@ void PostedListDialog::openComments(uint32_t /*feed_type*/, const RsGxsGroupId &
/*****************************************************************************************/ /*****************************************************************************************/
void PostedListDialog::updateDisplay(bool /*initialFill*/) void PostedListDialog::updateDisplay(bool /*complete*/)
{ {
std::cerr << "rsPosted->updateDisplay()"; std::cerr << "rsPosted->updateDisplay()";
std::cerr << std::endl; std::cerr << std::endl;

View file

@ -80,7 +80,7 @@ private slots:
void showPrev(); void showPrev();
protected: protected:
virtual void updateDisplay(bool initialFill); virtual void updateDisplay(bool complete);
private: private:
void updateShowText(); void updateShowText();

View file

@ -25,7 +25,7 @@ protected:
void showEvent(QShowEvent *e); void showEvent(QShowEvent *e);
signals: signals:
void fillDisplay(bool initialFill); void fillDisplay(bool complete);
private slots: private slots:
void updateBroadcastChanged(); void updateBroadcastChanged();

View file

@ -27,9 +27,9 @@ std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &RsGxsUpdateBroadcastPage::
return mBase->getMsgIds(); return mBase->getMsgIds();
} }
void RsGxsUpdateBroadcastPage::fillDisplay(bool initialFill) void RsGxsUpdateBroadcastPage::fillDisplay(bool complete)
{ {
updateDisplay(initialFill); updateDisplay(complete);
update(); // Qt flush update(); // Qt flush
} }

View file

@ -30,10 +30,10 @@ protected:
virtual void showEvent(QShowEvent *event); virtual void showEvent(QShowEvent *event);
// This is overloaded in subclasses. // This is overloaded in subclasses.
virtual void updateDisplay(bool initialFill) = 0; virtual void updateDisplay(bool complete) = 0;
private slots: private slots:
void fillDisplay(bool initialFill); void fillDisplay(bool complete);
private: private:
RsGxsUpdateBroadcastBase *mBase; RsGxsUpdateBroadcastBase *mBase;

View file

@ -27,9 +27,9 @@ std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &RsGxsUpdateBroadcastWidget
return mBase->getMsgIds(); return mBase->getMsgIds();
} }
void RsGxsUpdateBroadcastWidget::fillDisplay(bool initialFill) void RsGxsUpdateBroadcastWidget::fillDisplay(bool complete)
{ {
updateDisplay(initialFill); updateDisplay(complete);
update(); // Qt flush update(); // Qt flush
} }

View file

@ -30,10 +30,10 @@ protected:
virtual void showEvent(QShowEvent *event); virtual void showEvent(QShowEvent *event);
// This is overloaded in subclasses. // This is overloaded in subclasses.
virtual void updateDisplay(bool initialFill) = 0; virtual void updateDisplay(bool complete) = 0;
private slots: private slots:
void fillDisplay(bool initialFill); void fillDisplay(bool complete);
private: private:
RsGxsUpdateBroadcastBase *mBase; RsGxsUpdateBroadcastBase *mBase;

View file

@ -20,8 +20,6 @@
****************************************************************/ ****************************************************************/
#include <QDragEnterEvent> #include <QDragEnterEvent>
#include <QUrl>
#include <QTimer>
#include <QMessageBox> #include <QMessageBox>
#include <QBuffer> #include <QBuffer>
#include <QMenu> #include <QMenu>
@ -31,16 +29,13 @@
#include "CreateGxsChannelMsg.h" #include "CreateGxsChannelMsg.h"
#include "gui/feeds/SubFileItem.h" #include "gui/feeds/SubFileItem.h"
#include "util/misc.h" #include "util/misc.h"
#include "util/TokenQueue.h"
#include <retroshare/rsgxschannels.h>
#include <retroshare/rsfiles.h> #include <retroshare/rsfiles.h>
#include <iostream> #include <iostream>
#define CREATEMSG_CHANNELINFO 0x002 #define CREATEMSG_CHANNELINFO 0x002
/** Constructor */ /** Constructor */
CreateGxsChannelMsg::CreateGxsChannelMsg(std::string cId) CreateGxsChannelMsg::CreateGxsChannelMsg(std::string cId)
: QDialog (NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), mChannelId(cId) ,mCheckAttachment(true), mAutoMediaThumbNail(false) : QDialog (NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), mChannelId(cId) ,mCheckAttachment(true), mAutoMediaThumbNail(false)
@ -92,7 +87,6 @@ void CreateGxsChannelMsg::contextMenu(QPoint /*point*/)
QMenu contextMnu(this) ; QMenu contextMnu(this) ;
QAction *action ; QAction *action ;
if(n_file > 1) if(n_file > 1)
action = contextMnu.addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Links"), this, SLOT(pasteLink())); action = contextMnu.addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Links"), this, SLOT(pasteLink()));
else else
@ -135,12 +129,11 @@ void CreateGxsChannelMsg::pasteLink()
} }
} }
CreateGxsChannelMsg::~CreateGxsChannelMsg(){ CreateGxsChannelMsg::~CreateGxsChannelMsg()
{
#ifdef CHANNELS_FRAME_CATCHER #ifdef CHANNELS_FRAME_CATCHER
delete fCatcher; delete fCatcher;
#endif #endif
} }
/* Dropping */ /* Dropping */
@ -325,13 +318,11 @@ void CreateGxsChannelMsg::parseRsFileListAttachments(const std::string &attachLi
// TEMP NOT ALLOWED UNTIL FT WORKING. // TEMP NOT ALLOWED UNTIL FT WORKING.
addAttachment(hash, fname, size, false, source); addAttachment(hash, fname, size, false, source);
} }
} }
else else
{ {
std::cerr << "Error Decode: Hash size: " << hash.size() << std::endl; std::cerr << "Error Decode: Hash size: " << hash.size() << std::endl;
} }
} }
} }
@ -368,7 +359,6 @@ void CreateGxsChannelMsg::addAttachment(const std::string &hash, const std::stri
return; return;
} }
void CreateGxsChannelMsg::addExtraFile() void CreateGxsChannelMsg::addExtraFile()
{ {
/* add a SubFileItem to the attachment section */ /* add a SubFileItem to the attachment section */
@ -383,7 +373,6 @@ void CreateGxsChannelMsg::addExtraFile()
} }
} }
void CreateGxsChannelMsg::addAttachment(const std::string &path) void CreateGxsChannelMsg::addAttachment(const std::string &path)
{ {
/* add a SubFileItem to the attachment section */ /* add a SubFileItem to the attachment section */
@ -402,13 +391,10 @@ void CreateGxsChannelMsg::addAttachment(const std::string &path)
for(it= mAttachments.begin(); it != mAttachments.end(); it++){ for(it= mAttachments.begin(); it != mAttachments.end(); it++){
if((*it)->FilePath() == path){ if((*it)->FilePath() == path){
QMessageBox::warning(this, tr("RetroShare"), QMessageBox::warning(this, tr("RetroShare"), tr("File already Added and Hashed"), QMessageBox::Ok, QMessageBox::Ok);
tr("File already Added and Hashed"),
QMessageBox::Ok, QMessageBox::Ok);
return; return;
} }
} }
FileInfo fInfo; FileInfo fInfo;
@ -481,8 +467,8 @@ bool CreateGxsChannelMsg::setThumbNail(const std::string& path, int frame){
return true; return true;
} }
void CreateGxsChannelMsg::allowAutoMediaThumbNail(bool allowThumbNail){ void CreateGxsChannelMsg::allowAutoMediaThumbNail(bool allowThumbNail)
{
mAutoMediaThumbNail = allowThumbNail; mAutoMediaThumbNail = allowThumbNail;
} }
@ -520,7 +506,6 @@ void CreateGxsChannelMsg::checkAttachmentReady()
QTimer::singleShot( msec_rate, this, SLOT(checkAttachmentReady(void))); QTimer::singleShot( msec_rate, this, SLOT(checkAttachmentReady(void)));
} }
void CreateGxsChannelMsg::cancelMsg() void CreateGxsChannelMsg::cancelMsg()
{ {
std::cerr << "CreateGxsChannelMsg::cancelMsg() :" std::cerr << "CreateGxsChannelMsg::cancelMsg() :"
@ -533,8 +518,7 @@ void CreateGxsChannelMsg::cancelMsg()
for(it = mAttachments.begin(); it != mAttachments.end(); it++) for(it = mAttachments.begin(); it != mAttachments.end(); it++)
rsGxsChannels->ExtraFileRemove((*it)->FileHash()); rsGxsChannels->ExtraFileRemove((*it)->FileHash());
close(); reject();
return;
} }
void CreateGxsChannelMsg::newChannelMsg() void CreateGxsChannelMsg::newChannelMsg()
@ -560,7 +544,6 @@ void CreateGxsChannelMsg::newChannelMsg()
} }
} }
void CreateGxsChannelMsg::saveChannelInfo(const RsGroupMetaData &meta) void CreateGxsChannelMsg::saveChannelInfo(const RsGroupMetaData &meta)
{ {
mChannelMeta = meta; mChannelMeta = meta;
@ -570,7 +553,6 @@ void CreateGxsChannelMsg::saveChannelInfo(const RsGroupMetaData &meta)
subjectEdit->setFocus(); subjectEdit->setFocus();
} }
void CreateGxsChannelMsg::sendMsg() void CreateGxsChannelMsg::sendMsg()
{ {
std::cerr << "CreateGxsChannelMsg::sendMsg()"; std::cerr << "CreateGxsChannelMsg::sendMsg()";
@ -609,16 +591,13 @@ void CreateGxsChannelMsg::sendMsg()
} }
sendMessage(subject, msg, files); sendMessage(subject, msg, files);
} }
void CreateGxsChannelMsg::sendMessage(const std::string &subject, const std::string &msg, const std::list<RsGxsFile> &files) void CreateGxsChannelMsg::sendMessage(const std::string &subject, const std::string &msg, const std::list<RsGxsFile> &files)
{ {
if(subject.empty()) if(subject.empty())
{ /* error message */ { /* error message */
QMessageBox::warning(this, tr("RetroShare"), QMessageBox::warning(this, tr("RetroShare"), tr("Please add a Subject"), QMessageBox::Ok, QMessageBox::Ok);
tr("Please add a Subject"),
QMessageBox::Ok, QMessageBox::Ok);
return; //Don't add an empty Subject!! return; //Don't add an empty Subject!!
} }
@ -653,9 +632,7 @@ void CreateGxsChannelMsg::sendMessage(const std::string &subject, const std::str
rsGxsChannels->createPost(token, post); rsGxsChannels->createPost(token, post);
} }
close(); accept();
return;
} }
void CreateGxsChannelMsg::addThumbnail() void CreateGxsChannelMsg::addThumbnail()
@ -671,8 +648,6 @@ void CreateGxsChannelMsg::addThumbnail()
thumbnail_label->setPixmap(picture); thumbnail_label->setPixmap(picture);
} }
void CreateGxsChannelMsg::loadChannelInfo(const uint32_t &token) void CreateGxsChannelMsg::loadChannelInfo(const uint32_t &token)
{ {
std::cerr << "CreateGxsChannelMsg::loadChannelInfo()"; std::cerr << "CreateGxsChannelMsg::loadChannelInfo()";
@ -693,7 +668,6 @@ void CreateGxsChannelMsg::loadChannelInfo(const uint32_t &token)
} }
} }
void CreateGxsChannelMsg::loadRequest(const TokenQueue *queue, const TokenRequest &req) void CreateGxsChannelMsg::loadRequest(const TokenQueue *queue, const TokenRequest &req)
{ {
std::cerr << "CreateGxsChannelMsg::loadRequest() UserType: " << req.mUserType; std::cerr << "CreateGxsChannelMsg::loadRequest() UserType: " << req.mUserType;
@ -710,12 +684,6 @@ void CreateGxsChannelMsg::loadRequest(const TokenQueue *queue, const TokenReques
default: default:
std::cerr << "CreateGxsChannelMsg::loadRequest() UNKNOWN UserType "; std::cerr << "CreateGxsChannelMsg::loadRequest() UNKNOWN UserType ";
std::cerr << std::endl; std::cerr << std::endl;
} }
} }
} }

View file

@ -23,7 +23,6 @@
#define _CREATE_GXSCHANNEL_MSG_H #define _CREATE_GXSCHANNEL_MSG_H
#include "ui_CreateGxsChannelMsg.h" #include "ui_CreateGxsChannelMsg.h"
#include <stdint.h>
#include "util/TokenQueue.h" #include "util/TokenQueue.h"
#include <retroshare/rsgxschannels.h> #include <retroshare/rsgxschannels.h>
@ -32,7 +31,6 @@
#endif #endif
class SubFileItem; class SubFileItem;
class RsGxsFile;
class CreateGxsChannelMsg : public QDialog, public TokenResponse, private Ui::CreateGxsChannelMsg class CreateGxsChannelMsg : public QDialog, public TokenResponse, private Ui::CreateGxsChannelMsg
{ {
@ -42,7 +40,6 @@ public:
/** Default Constructor */ /** Default Constructor */
CreateGxsChannelMsg(std::string cId); CreateGxsChannelMsg(std::string cId);
/** Default Destructor */ /** Default Destructor */
~CreateGxsChannelMsg(); ~CreateGxsChannelMsg();
@ -56,7 +53,6 @@ public:
// overload from TokenResponse // overload from TokenResponse
virtual void loadRequest(const TokenQueue*, const TokenRequest&); virtual void loadRequest(const TokenQueue*, const TokenRequest&);
protected: protected:
virtual void dragEnterEvent(QDragEnterEvent *event); virtual void dragEnterEvent(QDragEnterEvent *event);
virtual void dropEvent(QDropEvent *event); virtual void dropEvent(QDropEvent *event);
@ -74,7 +70,6 @@ private slots:
void allowAutoMediaThumbNail(bool); void allowAutoMediaThumbNail(bool);
private: private:
void loadChannelInfo(const uint32_t &token); void loadChannelInfo(const uint32_t &token);
void saveChannelInfo(const RsGroupMetaData &group); void saveChannelInfo(const RsGroupMetaData &group);
@ -96,8 +91,6 @@ private:
#ifdef CHANNELS_FRAME_CATCHER #ifdef CHANNELS_FRAME_CATCHER
framecatcher* fCatcher; framecatcher* fCatcher;
#endif #endif
}; };
#endif #endif

View file

@ -20,33 +20,16 @@
****************************************************************/ ****************************************************************/
#include <QMenu> #include <QMenu>
#include <QTimer>
#include <QStandardItemModel>
#include <QMessageBox> #include <QMessageBox>
#include <iostream> #include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include "GxsChannelDialog.h" #include "GxsChannelDialog.h"
#include "gui/feeds/GxsChannelPostItem.h" #include "gui/feeds/GxsChannelPostItem.h"
#include "gui/settings/rsharesettings.h"
#include "../common/PopularityDefs.h"
#include "../settings/rsharesettings.h"
#include "gui/gxschannels/GxsChannelGroupDialog.h" #include "gui/gxschannels/GxsChannelGroupDialog.h"
#include "gui/gxschannels/CreateGxsChannelMsg.h" #include "gui/gxschannels/CreateGxsChannelMsg.h"
#include "gui/common/UIStateHelper.h"
//#include "../channels/ChannelDetails.h"
//#include "../channels/EditChanDetails.h"
#include "../channels/ShareKey.h"
#include "../channels/ChannelUserNotify.h"
#include "../notifyqt.h"
#include "../RetroShareLink.h"
#define CHAN_DEFAULT_IMAGE ":/images/channels.png" #define CHAN_DEFAULT_IMAGE ":/images/channels.png"
@ -59,12 +42,11 @@
#define IMAGE_CHANNELYELLOW ":/images/channelsyellow.png" #define IMAGE_CHANNELYELLOW ":/images/channelsyellow.png"
/**** /****
* #define CHAN_DEBUG * #define DEBUG_CHANNEL
***/ ***/
#define USE_THREAD #define USE_THREAD
#define TOKEN_TYPE_GROUP_CHANGE 1 // THIS MUST MIRROR GxsGroupDialog parameters. #define TOKEN_TYPE_GROUP_CHANGE 1 // THIS MUST MIRROR GxsGroupDialog parameters.
#define TOKEN_TYPE_MESSAGE_CHANGE 4 #define TOKEN_TYPE_MESSAGE_CHANGE 4
@ -74,24 +56,33 @@
/** Constructor */ /** Constructor */
GxsChannelDialog::GxsChannelDialog(QWidget *parent) GxsChannelDialog::GxsChannelDialog(QWidget *parent)
: RsAutoUpdatePage(1000,parent), GxsServiceDialog(dynamic_cast<GxsCommentContainer *>(parent)) : RsGxsUpdateBroadcastPage(rsGxsChannels, parent), GxsServiceDialog(dynamic_cast<GxsCommentContainer *>(parent))
{ {
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this); ui.setupUi(this);
/* Setup UI helper */
mStateHelper = new UIStateHelper(this);
mStateHelper->addWidget(TOKEN_TYPE_POSTS, ui.progressBar, UISTATE_LOADING_VISIBLE);
mStateHelper->addWidget(TOKEN_TYPE_POSTS, ui.progressLabel, UISTATE_LOADING_VISIBLE);
mStateHelper->addLoadPlaceholder(TOKEN_TYPE_GROUP_DATA, ui.nameLabel);
mStateHelper->addWidget(TOKEN_TYPE_GROUP_DATA, ui.postButton);
mStateHelper->addWidget(TOKEN_TYPE_GROUP_DATA, ui.logoLabel);
mChannelQueue = new TokenQueue(rsGxsChannels->getTokenService(), this); mChannelQueue = new TokenQueue(rsGxsChannels->getTokenService(), this);
connect(ui.newChannelButton, SIGNAL(clicked()), this, SLOT(createChannel())); connect(ui.newChannelButton, SIGNAL(clicked()), this, SLOT(createChannel()));
connect(ui.postButton, SIGNAL(clicked()), this, SLOT(createMsg())); connect(ui.postButton, SIGNAL(clicked()), this, SLOT(createMsg()));
connect(NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int))); // connect(NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)));
connect(ui.refreshButton, SIGNAL(clicked()), this, SLOT(forceUpdateDisplay()));
/*************** Setup Left Hand Side (List of Channels) ****************/ /*************** Setup Left Hand Side (List of Channels) ****************/
connect(ui.treeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT(channelListCustomPopupMenu(QPoint))); connect(ui.treeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT(channelListCustomPopupMenu(QPoint)));
connect(ui.treeWidget, SIGNAL(treeCurrentItemChanged(QString)), this, SLOT(selectChannel(QString))); connect(ui.treeWidget, SIGNAL(treeCurrentItemChanged(QString)), this, SLOT(selectChannel(QString)));
connect(ui.todoPushButton, SIGNAL(clicked()), this, SLOT(todo()));
mChannelId.clear(); mChannelId.clear();
@ -111,16 +102,13 @@ GxsChannelDialog::GxsChannelDialog(QWidget *parent)
ui.progressLabel->hide(); ui.progressLabel->hide();
ui.progressBar->hide(); ui.progressBar->hide();
//added from ahead
//updateChannelList();
forceUpdateDisplay();
ui.nameLabel->setMinimumWidth(20); ui.nameLabel->setMinimumWidth(20);
/* load settings */ /* load settings */
processSettings(true); processSettings(true);
insertChannels(); /* Initialize empty GUI */
requestGroupData(mChannelId);
} }
GxsChannelDialog::~GxsChannelDialog() GxsChannelDialog::~GxsChannelDialog()
@ -129,33 +117,33 @@ GxsChannelDialog::~GxsChannelDialog()
processSettings(false); processSettings(false);
} }
void GxsChannelDialog::todo()
void GxsChannelDialog::updateDisplay()
{ {
if (!rsGxsChannels) QMessageBox::information(this, "Todo",
return; "<b>Open points:</b><ul>"
"<li>Threaded load of messages"
std::list<std::string> groupIds; "<li>Share key"
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgs; "<li>Restore channel keys"
"<li>Copy/navigate channel link"
if (rsGxsChannels->updated(true, true)) "<li>Display count of unread messages"
{ "<li>Show/Edit channel details"
/* update Forums List */ "<li>Set all as read"
"<li>Set read/unread status"
rsGxsChannels->groupsChanged(groupIds); "</ul>");
if(!groupIds.empty())
{
// just always update.
insertChannels();
//std::list<std::string>::iterator it = std::find(groupIds.begin(), groupIds.end(), mChannelId);
//if(it != groupIds.end()){
// requestGroupSummary();
// return;
//}
} }
rsGxsChannels->msgsChanged(msgs); void GxsChannelDialog::updateDisplay(bool complete)
{
std::list<RsGxsGroupId> &grpIds = getGrpIds();
if (complete || !grpIds.empty()) {
/* Update channel list */
insertChannels();
}
if (!mChannelId.empty() && std::find(grpIds.begin(), grpIds.end(), mChannelId) != grpIds.end()) {
requestGroupData(mChannelId);
}
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgs = getMsgIds();
if (!msgs.empty()) if (!msgs.empty())
{ {
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator mit = msgs.find(mChannelId); std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator mit = msgs.find(mChannelId);
@ -165,26 +153,17 @@ void GxsChannelDialog::updateDisplay()
} }
} }
} }
}
// Callback from Widget->FeedHolder->ServiceDialog->CommentContainer->CommentDialog, // Callback from Widget->FeedHolder->ServiceDialog->CommentContainer->CommentDialog,
void GxsChannelDialog::openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title) void GxsChannelDialog::openComments(uint32_t /*type*/, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title)
{ {
commentLoad(groupId, msgId, title); commentLoad(groupId, msgId, title);
} }
//UserNotify *GxsChannelDialog::getUserNotify(QObject *parent)
UserNotify *GxsChannelDialog::getUserNotify(QObject *parent) //{
{ // return new ChannelUserNotify(parent);
return new ChannelUserNotify(parent); //}
return NULL;
}
void GxsChannelDialog::processSettings(bool load) void GxsChannelDialog::processSettings(bool load)
{ {
@ -233,7 +212,6 @@ void GxsChannelDialog::channelListCustomPopupMenu( QPoint /*point*/ )
if (isSubscribed) if (isSubscribed)
{ {
QAction *setallasreadchannelAct = new QAction(QIcon(":/images/message-mail-read.png"), tr( "Set all as read" ), &contextMnu); QAction *setallasreadchannelAct = new QAction(QIcon(":/images/message-mail-read.png"), tr( "Set all as read" ), &contextMnu);
connect( setallasreadchannelAct , SIGNAL( triggered() ), this, SLOT( setAllAsReadClicked() ) ); connect( setallasreadchannelAct , SIGNAL( triggered() ), this, SLOT( setAllAsReadClicked() ) );
contextMnu.addAction( setallasreadchannelAct ); contextMnu.addAction( setallasreadchannelAct );
@ -254,7 +232,6 @@ void GxsChannelDialog::channelListCustomPopupMenu( QPoint /*point*/ )
QAction *unsubscribechannelAct = new QAction(QIcon(":/images/cancel.png"), tr( "Unsubscribe to Channel" ), &contextMnu); QAction *unsubscribechannelAct = new QAction(QIcon(":/images/cancel.png"), tr( "Unsubscribe to Channel" ), &contextMnu);
connect( unsubscribechannelAct , SIGNAL( triggered() ), this, SLOT( unsubscribeChannel() ) ); connect( unsubscribechannelAct , SIGNAL( triggered() ), this, SLOT( unsubscribeChannel() ) );
contextMnu.addAction( unsubscribechannelAct ); contextMnu.addAction( unsubscribechannelAct );
} }
else else
{ {
@ -263,7 +240,6 @@ void GxsChannelDialog::channelListCustomPopupMenu( QPoint /*point*/ )
contextMnu.addAction( subscribechannelAct ); contextMnu.addAction( subscribechannelAct );
} }
if (isAdmin) if (isAdmin)
{ {
QAction *editChannelDetailAct = new QAction(QIcon(":/images/edit_16.png"), tr("Edit Channel Details"), &contextMnu); QAction *editChannelDetailAct = new QAction(QIcon(":/images/edit_16.png"), tr("Edit Channel Details"), &contextMnu);
@ -296,7 +272,6 @@ void GxsChannelDialog::channelListCustomPopupMenu( QPoint /*point*/ )
contextMnu.exec(QCursor::pos()); contextMnu.exec(QCursor::pos());
#if 0 #if 0
ChannelInfo ci; ChannelInfo ci;
if (!rsChannels->getChannelInfo(mChannelId, ci)) { if (!rsChannels->getChannelInfo(mChannelId, ci)) {
@ -363,7 +338,7 @@ void GxsChannelDialog::channelListCustomPopupMenu( QPoint /*point*/ )
QAction *action = contextMnu.addAction(QIcon(":/images/copyrslink.png"), tr("Copy RetroShare Link"), this, SLOT(copyChannelLink())); QAction *action = contextMnu.addAction(QIcon(":/images/copyrslink.png"), tr("Copy RetroShare Link"), this, SLOT(copyChannelLink()));
action->setEnabled(!mChannelId.empty()); action->setEnabled(!mChannelId.empty());
#ifdef CHAN_DEBUG #ifdef DEBUG_CHANNEL
contextMnu.addSeparator(); contextMnu.addSeparator();
action = contextMnu.addAction("Generate mass data", this, SLOT(generateMassData())); action = contextMnu.addAction("Generate mass data", this, SLOT(generateMassData()));
action->setEnabled (!mChannelId.empty() && (ci.channelFlags & RS_DISTRIB_PUBLISH)); action->setEnabled (!mChannelId.empty() && (ci.channelFlags & RS_DISTRIB_PUBLISH));
@ -372,7 +347,6 @@ void GxsChannelDialog::channelListCustomPopupMenu( QPoint /*point*/ )
contextMnu.exec(QCursor::pos()); contextMnu.exec(QCursor::pos());
#endif #endif
} }
void GxsChannelDialog::createChannel() void GxsChannelDialog::createChannel()
@ -396,7 +370,6 @@ void GxsChannelDialog::deleteFeedItem(QWidget * /*item*/, uint32_t /*type*/)
void GxsChannelDialog::openChat(std::string /*peerId*/) void GxsChannelDialog::openChat(std::string /*peerId*/)
{ {
} }
void GxsChannelDialog::editChannelDetail() void GxsChannelDialog::editChannelDetail()
@ -413,12 +386,10 @@ void GxsChannelDialog::shareKey()
ShareKey shareUi(this, mChannelId, CHANNEL_KEY_SHARE); ShareKey shareUi(this, mChannelId, CHANNEL_KEY_SHARE);
shareUi.exec(); shareUi.exec();
#endif #endif
} }
void GxsChannelDialog::copyChannelLink() void GxsChannelDialog::copyChannelLink()
{ {
#if 0 #if 0
if (mChannelId.empty()) { if (mChannelId.empty()) {
return; return;
@ -434,7 +405,6 @@ void GxsChannelDialog::copyChannelLink()
} }
} }
#endif #endif
} }
void GxsChannelDialog::createMsg() void GxsChannelDialog::createMsg()
@ -445,18 +415,18 @@ void GxsChannelDialog::createMsg()
CreateGxsChannelMsg *msgDialog = new CreateGxsChannelMsg(mChannelId); CreateGxsChannelMsg *msgDialog = new CreateGxsChannelMsg(mChannelId);
msgDialog->show(); msgDialog->show();
/* window will destroy itself! */
} }
void GxsChannelDialog::restoreChannelKeys() void GxsChannelDialog::restoreChannelKeys()
{ {
#if 0 #if 0
if(rsChannels->channelRestoreKeys(mChannelId)) if(rsChannels->channelRestoreKeys(mChannelId))
QMessageBox::information(NULL,tr("Publish rights restored."),tr("Publish rights have been restored for this channel.")) ; QMessageBox::information(NULL,tr("Publish rights restored."),tr("Publish rights have been restored for this channel.")) ;
else else
QMessageBox::warning(NULL,tr("Publish not restored."),tr("Publish rights can't be restored for this channel.<br/>You're not the creator of this channel.")) ; QMessageBox::warning(NULL,tr("Publish not restored."),tr("Publish rights can't be restored for this channel.<br/>You're not the creator of this channel.")) ;
#endif #endif
} }
void GxsChannelDialog::selectChannel(const QString &id) void GxsChannelDialog::selectChannel(const QString &id)
@ -466,16 +436,8 @@ void GxsChannelDialog::selectChannel(const QString &id)
bool autoDl = rsGxsChannels->getChannelAutoDownload(mChannelId); bool autoDl = rsGxsChannels->getChannelAutoDownload(mChannelId);
setAutoDownloadButton(autoDl); setAutoDownloadButton(autoDl);
requestGroupData(mChannelId);
requestPosts(mChannelId); requestPosts(mChannelId);
//updateChannelMsgs();
}
void GxsChannelDialog::forceUpdateDisplay()
{
std::cerr << "GxsChannelDialog::forceUpdateDisplay()";
std::cerr << std::endl;
insertChannels();
} }
static void channelInfoToGroupItemInfo(const RsGroupMetaData &channelInfo, GroupItemInfo &groupItemInfo) static void channelInfoToGroupItemInfo(const RsGroupMetaData &channelInfo, GroupItemInfo &groupItemInfo)
@ -558,15 +520,13 @@ void GxsChannelDialog::insertChannelData(const std::list<RsGroupMetaData> &chann
updateMessageSummaryList(""); updateMessageSummaryList("");
} }
//void GxsChannelDialog::channelMsgReadSatusChanged(const QString& channelId, const QString& /*msgId*/, int /*status*/)
void GxsChannelDialog::channelMsgReadSatusChanged(const QString& channelId, const QString& /*msgId*/, int /*status*/) //{
{ // updateMessageSummaryList(channelId.toStdString());
updateMessageSummaryList(channelId.toStdString()); //}
}
void GxsChannelDialog::updateMessageSummaryList(const std::string &channelId) void GxsChannelDialog::updateMessageSummaryList(const std::string &channelId)
{ {
#if 0 #if 0
QTreeWidgetItem *items[2] = { ownChannels, subcribedChannels }; QTreeWidgetItem *items[2] = { ownChannels, subcribedChannels };
@ -596,7 +556,6 @@ void GxsChannelDialog::updateMessageSummaryList(const std::string &channelId)
} }
} }
#endif #endif
} }
#if 0 #if 0
@ -606,11 +565,63 @@ static bool sortChannelMsgSummary(const ChannelMsgSummary &msg1, const ChannelMs
} }
#endif #endif
void GxsChannelDialog::insertChannelDetails(const RsGxsChannelGroup &group)
{
/* IMAGE */
QPixmap chanImage;
if (group.mImage.mData != NULL) {
chanImage.loadFromData(group.mImage.mData, group.mImage.mSize, "PNG");
} else {
chanImage = QPixmap(CHAN_DEFAULT_IMAGE);
}
ui.logoLabel->setPixmap(chanImage);
/* set Channel name */
ui.nameLabel->setText(QString::fromUtf8(group.mMeta.mGroupName.c_str()));
if (group.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_PUBLISH)
{
mStateHelper->setWidgetEnabled(ui.postButton, true);
}
else
{
mStateHelper->setWidgetEnabled(ui.postButton, false);
}
if (group.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED)
{
ui.actionEnable_Auto_Download->setEnabled(true);
}
else
{
ui.actionEnable_Auto_Download->setEnabled(false);
}
}
void GxsChannelDialog::insertChannelPosts(const std::vector<RsGxsChannelPost> &posts)
{
std::vector<RsGxsChannelPost>::const_iterator it;
// Do these need sorting? probably.
// can we add that into the request?
//msgs.sort(sortChannelMsgSummary);
uint32_t subscribeFlags = 0xffffffff;
for (it = posts.begin(); it != posts.end(); it++)
{
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, *it, subscribeFlags, true);
mChannelPostItems.push_back(item);
ui.verticalLayout->addWidget(item);
}
}
#if 0 #if 0
void GxsChannelDialog::updateChannelMsgs() void GxsChannelDialog::updateChannelMsgs()
{ {
if (fillThread) { if (fillThread) {
#ifdef CHAN_DEBUG #ifdef DEBUG_CHANNEL
std::cerr << "GxsChannelDialog::updateChannelMsgs() stop current fill thread" << std::endl; std::cerr << "GxsChannelDialog::updateChannelMsgs() stop current fill thread" << std::endl;
#endif #endif
// stop current fill thread // stop current fill thread
@ -680,7 +691,7 @@ void GxsChannelDialog::updateChannelMsgs()
connect(fillThread, SIGNAL(finished()), this, SLOT(fillThreadFinished()), Qt::BlockingQueuedConnection); connect(fillThread, SIGNAL(finished()), this, SLOT(fillThreadFinished()), Qt::BlockingQueuedConnection);
connect(fillThread, SIGNAL(addMsg(QString,QString,int,int)), this, SLOT(fillThreadAddMsg(QString,QString,int,int)), Qt::BlockingQueuedConnection); connect(fillThread, SIGNAL(addMsg(QString,QString,int,int)), this, SLOT(fillThreadAddMsg(QString,QString,int,int)), Qt::BlockingQueuedConnection);
#ifdef CHAN_DEBUG #ifdef DEBUG_CHANNEL
std::cerr << "GxsChannelDialog::updateChannelMsgs() Start fill thread" << std::endl; std::cerr << "GxsChannelDialog::updateChannelMsgs() Start fill thread" << std::endl;
#endif #endif
@ -703,7 +714,7 @@ void GxsChannelDialog::updateChannelMsgs()
void GxsChannelDialog::fillThreadFinished() void GxsChannelDialog::fillThreadFinished()
{ {
#ifdef CHAN_DEBUG #ifdef DEBUG_CHANNEL
std::cerr << "GxsChannelDialog::fillThreadFinished()" << std::endl; std::cerr << "GxsChannelDialog::fillThreadFinished()" << std::endl;
#endif #endif
@ -717,14 +728,14 @@ void GxsChannelDialog::fillThreadFinished()
fillThread = NULL; fillThread = NULL;
} }
#ifdef CHAN_DEBUG #ifdef DEBUG_CHANNEL
if (thread->wasStopped()) { if (thread->wasStopped()) {
// thread was stopped // thread was stopped
std::cerr << "GxsChannelDialog::fillThreadFinished() Thread was stopped" << std::endl; std::cerr << "GxsChannelDialog::fillThreadFinished() Thread was stopped" << std::endl;
} }
#endif #endif
#ifdef CHAN_DEBUG #ifdef DEBUG_CHANNEL
std::cerr << "GxsChannelDialog::fillThreadFinished() Delete thread" << std::endl; std::cerr << "GxsChannelDialog::fillThreadFinished() Delete thread" << std::endl;
#endif #endif
@ -732,7 +743,7 @@ void GxsChannelDialog::fillThreadFinished()
thread = NULL; thread = NULL;
} }
#ifdef CHAN_DEBUG #ifdef DEBUG_CHANNEL
std::cerr << "GxsChannelDialog::fillThreadFinished done()" << std::endl; std::cerr << "GxsChannelDialog::fillThreadFinished done()" << std::endl;
#endif #endif
} }
@ -758,10 +769,9 @@ void GxsChannelDialog::fillThreadAddMsg(const QString &channelId, const QString
#endif #endif
void GxsChannelDialog::unsubscribeChannel() void GxsChannelDialog::unsubscribeChannel()
{ {
#ifdef CHAN_DEBUG #ifdef DEBUG_CHANNEL
std::cerr << "GxsChannelDialog::unsubscribeChannel()"; std::cerr << "GxsChannelDialog::unsubscribeChannel()";
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
@ -774,10 +784,9 @@ void GxsChannelDialog::unsubscribeChannel()
mChannelQueue->queueRequest(token, 0 , RS_TOKREQ_ANSTYPE_ACK, TOKEN_TYPE_GROUP_CHANGE); mChannelQueue->queueRequest(token, 0 , RS_TOKREQ_ANSTYPE_ACK, TOKEN_TYPE_GROUP_CHANGE);
} }
void GxsChannelDialog::subscribeChannel() void GxsChannelDialog::subscribeChannel()
{ {
#ifdef CHAN_DEBUG #ifdef DEBUG_CHANNEL
std::cerr << "GxsChannelDialog::subscribeChannel()"; std::cerr << "GxsChannelDialog::subscribeChannel()";
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
@ -806,7 +815,6 @@ void GxsChannelDialog::showChannelDetails()
channelui.showDetails(mChannelId); channelui.showDetails(mChannelId);
channelui.exec(); channelui.exec();
#endif #endif
} }
void GxsChannelDialog::setAllAsReadClicked() void GxsChannelDialog::setAllAsReadClicked()
@ -843,10 +851,7 @@ void GxsChannelDialog::toggleAutoDownload()
if (mChannelId.empty()) if (mChannelId.empty())
return; return;
bool autoDl = true; bool autoDl = rsGxsChannels->getChannelAutoDownload(mChannelId);
autoDl = rsGxsChannels->getChannelAutoDownload(mChannelId);
if (rsGxsChannels->setChannelAutoDownload(mChannelId, !autoDl)) if (rsGxsChannels->setChannelAutoDownload(mChannelId, !autoDl))
{ {
setAutoDownloadButton(!autoDl); setAutoDownloadButton(!autoDl);
@ -860,7 +865,6 @@ void GxsChannelDialog::toggleAutoDownload()
bool GxsChannelDialog::navigate(const std::string& channelId, const std::string& msgId) bool GxsChannelDialog::navigate(const std::string& channelId, const std::string& msgId)
{ {
#if 0 #if 0
if (channelId.empty()) { if (channelId.empty()) {
return false; return false;
@ -906,8 +910,6 @@ void GxsChannelDialog::setAutoDownloadButton(bool autoDl)
} }
} }
/********************************************************************************************** /**********************************************************************************************
* New Stuff here. * New Stuff here.
*************/ *************/
@ -923,20 +925,14 @@ void GxsChannelDialog::insertChannels()
void GxsChannelDialog::requestGroupSummary() void GxsChannelDialog::requestGroupSummary()
{ {
mStateHelper->setLoading(TOKEN_TYPE_LISTING, true);
#ifdef DEBUG_CHANNEL
std::cerr << "GxsChannelDialog::requestGroupSummary()"; std::cerr << "GxsChannelDialog::requestGroupSummary()";
std::cerr << std::endl; std::cerr << std::endl;
#endif
std::list<uint32_t> tokens; mChannelQueue->cancelActiveRequestTokens(TOKEN_TYPE_LISTING);
mChannelQueue->activeRequestTokens(TOKEN_TYPE_LISTING, tokens);
if (!tokens.empty()) {
std::list<uint32_t>::iterator tokenIt;
for (tokenIt = tokens.begin(); tokenIt != tokens.end(); ++tokenIt) {
std::cerr << "GxsChannelDialog::requestGroupSummary() Canceling Request: " << *tokenIt;
std::cerr << std::endl;
mChannelQueue->cancelRequest(*tokenIt);
}
}
RsTokReqOptions opts; RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META; opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
@ -947,41 +943,54 @@ void GxsChannelDialog::requestGroupSummary()
void GxsChannelDialog::loadGroupSummary(const uint32_t &token) void GxsChannelDialog::loadGroupSummary(const uint32_t &token)
{ {
#ifdef DEBUG_CHANNEL
std::cerr << "GxsChannelDialog::loadGroupSummary()"; std::cerr << "GxsChannelDialog::loadGroupSummary()";
std::cerr << std::endl; std::cerr << std::endl;
#endif
std::list<RsGroupMetaData> groupInfo; std::list<RsGroupMetaData> groupInfo;
rsGxsChannels->getGroupSummary(token, groupInfo); rsGxsChannels->getGroupSummary(token, groupInfo);
if (groupInfo.size() > 0) if (groupInfo.size() > 0)
{ {
mStateHelper->setActive(TOKEN_TYPE_LISTING, true);
insertChannelData(groupInfo); insertChannelData(groupInfo);
} }
else else
{ {
std::cerr << "GxsChannelDialog::loadGroupSummary() ERROR No Groups..."; std::cerr << "GxsChannelDialog::loadGroupSummary() ERROR No Groups...";
std::cerr << std::endl; std::cerr << std::endl;
}
mStateHelper->setActive(TOKEN_TYPE_LISTING, false);
mStateHelper->clear(TOKEN_TYPE_LISTING);
} }
mStateHelper->setLoading(TOKEN_TYPE_LISTING, false);
}
void GxsChannelDialog::requestGroupData(const RsGxsGroupId &grpId) void GxsChannelDialog::requestGroupData(const RsGxsGroupId &grpId)
{ {
#ifdef DEBUG_CHANNEL
std::cerr << "GxsChannelDialog::requestGroupData()"; std::cerr << "GxsChannelDialog::requestGroupData()";
std::cerr << std::endl; std::cerr << std::endl;
#endif
std::list<uint32_t> tokens; mChannelQueue->cancelActiveRequestTokens(TOKEN_TYPE_GROUP_DATA);
mChannelQueue->activeRequestTokens(TOKEN_TYPE_GROUP_DATA, tokens);
if (!tokens.empty()) {
std::list<uint32_t>::iterator tokenIt;
for (tokenIt = tokens.begin(); tokenIt != tokens.end(); ++tokenIt) {
std::cerr << "GxsChannelDialog::requestGroupData() Canceling Request: " << *tokenIt;
std::cerr << std::endl;
mChannelQueue->cancelRequest(*tokenIt); if (grpId.empty()) {
} mStateHelper->setActive(TOKEN_TYPE_GROUP_DATA, false);
mStateHelper->setLoading(TOKEN_TYPE_GROUP_DATA, false);
mStateHelper->clear(TOKEN_TYPE_GROUP_DATA);
ui.nameLabel->setText(tr("No Channel Selected"));
ui.logoLabel->setPixmap(QPixmap(":/images/channels.png"));
return;
} }
mStateHelper->setLoading(TOKEN_TYPE_GROUP_DATA, true);
std::list<RsGxsGroupId> groupIds; std::list<RsGxsGroupId> groupIds;
groupIds.push_back(grpId); groupIds.push_back(grpId);
@ -990,46 +999,61 @@ void GxsChannelDialog::requestGroupData(const RsGxsGroupId &grpId)
uint32_t token; uint32_t token;
mChannelQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, TOKEN_TYPE_GROUP_DATA); mChannelQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, TOKEN_TYPE_GROUP_DATA);
} }
void GxsChannelDialog::loadGroupData(const uint32_t &token) void GxsChannelDialog::loadGroupData(const uint32_t &token)
{ {
#ifdef DEBUG_CHANNEL
std::cerr << "GxsChannelDialog::loadGroupData()"; std::cerr << "GxsChannelDialog::loadGroupData()";
std::cerr << std::endl; std::cerr << std::endl;
#endif
std::vector<RsGxsChannelGroup> groups; std::vector<RsGxsChannelGroup> groups;
rsGxsChannels->getGroupData(token, groups); rsGxsChannels->getGroupData(token, groups);
mStateHelper->setLoading(TOKEN_TYPE_GROUP_DATA, false);
if (groups.size() == 1) if (groups.size() == 1)
{ {
mStateHelper->setActive(TOKEN_TYPE_GROUP_DATA, true);
insertChannelDetails(groups[0]); insertChannelDetails(groups[0]);
} }
else else
{ {
std::cerr << "GxsChannelDialog::loadGroupData() ERROR Not just one Group"; std::cerr << "GxsChannelDialog::loadGroupData() ERROR Not just one Group";
std::cerr << std::endl; std::cerr << std::endl;
}
}
mStateHelper->setActive(TOKEN_TYPE_GROUP_DATA, false);
mStateHelper->clear(TOKEN_TYPE_GROUP_DATA);
}
}
void GxsChannelDialog::requestPosts(const RsGxsGroupId &grpId) void GxsChannelDialog::requestPosts(const RsGxsGroupId &grpId)
{ {
#ifdef DEBUG_CHANNEL
std::cerr << "GxsChannelDialog::requestPosts()"; std::cerr << "GxsChannelDialog::requestPosts()";
std::cerr << std::endl; std::cerr << std::endl;
#endif
std::list<uint32_t> tokens; /* replace all the messages with new ones */
mChannelQueue->activeRequestTokens(TOKEN_TYPE_POSTS, tokens); QList<GxsChannelPostItem *>::iterator mit;
if (!tokens.empty()) { for (mit = mChannelPostItems.begin(); mit != mChannelPostItems.end(); mit++) {
std::list<uint32_t>::iterator tokenIt; delete (*mit);
for (tokenIt = tokens.begin(); tokenIt != tokens.end(); ++tokenIt) { }
std::cerr << "GxsChannelDialog::requestPosts() Canceling Request: " << *tokenIt; mChannelPostItems.clear();
std::cerr << std::endl;
mChannelQueue->cancelRequest(*tokenIt); mChannelQueue->cancelActiveRequestTokens(TOKEN_TYPE_POSTS);
}
if (grpId.empty()) {
mStateHelper->setActive(TOKEN_TYPE_POSTS, false);
mStateHelper->setLoading(TOKEN_TYPE_POSTS, false);
mStateHelper->clear(TOKEN_TYPE_POSTS);
return;
} }
mStateHelper->setLoading(TOKEN_TYPE_POSTS, true);
std::list<RsGxsGroupId> groupIds; std::list<RsGxsGroupId> groupIds;
groupIds.push_back(grpId); groupIds.push_back(grpId);
@ -1042,31 +1066,39 @@ void GxsChannelDialog::requestPosts(const RsGxsGroupId &grpId)
void GxsChannelDialog::loadPosts(const uint32_t &token) void GxsChannelDialog::loadPosts(const uint32_t &token)
{ {
#ifdef DEBUG_CHANNEL
std::cerr << "GxsChannelDialog::loadPosts()"; std::cerr << "GxsChannelDialog::loadPosts()";
std::cerr << std::endl; std::cerr << std::endl;
#endif
std::vector<RsGxsChannelPost> posts; std::vector<RsGxsChannelPost> posts;
rsGxsChannels->getPostData(token, posts); rsGxsChannels->getPostData(token, posts);
insertChannelPosts(posts); mStateHelper->setActive(TOKEN_TYPE_POSTS, true);
}
insertChannelPosts(posts);
mStateHelper->setLoading(TOKEN_TYPE_POSTS, false);
}
void GxsChannelDialog::acknowledgeGroupUpdate(const uint32_t &token) void GxsChannelDialog::acknowledgeGroupUpdate(const uint32_t &token)
{ {
#ifdef DEBUG_CHANNEL
std::cerr << "GxsChannelDialog::acknowledgeGroupUpdate()"; std::cerr << "GxsChannelDialog::acknowledgeGroupUpdate()";
std::cerr << std::endl; std::cerr << std::endl;
#endif
RsGxsGroupId grpId; RsGxsGroupId grpId;
rsGxsChannels->acknowledgeGrp(token, grpId); rsGxsChannels->acknowledgeGrp(token, grpId);
insertChannels(); insertChannels();
} }
void GxsChannelDialog::acknowledgeMessageUpdate(const uint32_t &token) void GxsChannelDialog::acknowledgeMessageUpdate(const uint32_t &token)
{ {
#ifdef DEBUG_CHANNEL
std::cerr << "GxsChannelDialog::acknowledgeMessageUpdate() TODO"; std::cerr << "GxsChannelDialog::acknowledgeMessageUpdate() TODO";
std::cerr << std::endl; std::cerr << std::endl;
#endif
std::pair<RsGxsGroupId, RsGxsMessageId> msgId; std::pair<RsGxsGroupId, RsGxsMessageId> msgId;
rsGxsChannels->acknowledgeMsg(token, msgId); rsGxsChannels->acknowledgeMsg(token, msgId);
@ -1076,11 +1108,12 @@ void GxsChannelDialog::acknowledgeMessageUpdate(const uint32_t &token)
} }
} }
void GxsChannelDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req) void GxsChannelDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
{ {
#ifdef DEBUG_CHANNEL
std::cerr << "GxsChannelDialog::loadRequest() UserType: " << req.mUserType; std::cerr << "GxsChannelDialog::loadRequest() UserType: " << req.mUserType;
std::cerr << std::endl; std::cerr << std::endl;
#endif
if (queue == mChannelQueue) if (queue == mChannelQueue)
{ {
@ -1109,77 +1142,3 @@ void GxsChannelDialog::loadRequest(const TokenQueue *queue, const TokenRequest &
} }
} }
} }
void GxsChannelDialog::insertChannelDetails(const RsGxsChannelGroup &group)
{
/* replace all the messages with new ones */
QList<GxsChannelPostItem *>::iterator mit;
for (mit = mChannelPostItems.begin(); mit != mChannelPostItems.end(); mit++) {
delete (*mit);
}
mChannelPostItems.clear();
/* IMAGE */
QPixmap chanImage;
if (group.mImage.mData != NULL) {
chanImage.loadFromData(group.mImage.mData, group.mImage.mSize, "PNG");
} else {
chanImage = QPixmap(CHAN_DEFAULT_IMAGE);
}
ui.logoLabel->setPixmap(chanImage);
ui.logoLabel->setEnabled(true);
/* set Channel name */
ui.nameLabel->setText(QString::fromUtf8(group.mMeta.mGroupName.c_str()));
if (group.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_PUBLISH)
{
ui.postButton->setEnabled(true);
}
else
{
ui.postButton->setEnabled(false);
}
if (group.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED)
{
ui.actionEnable_Auto_Download->setEnabled(true);
}
else
{
ui.actionEnable_Auto_Download->setEnabled(false);
}
}
void GxsChannelDialog::insertChannelPosts(const std::vector<RsGxsChannelPost> &posts)
{
std::vector<RsGxsChannelPost>::const_iterator it;
// Do these need sorting? probably.
// can we add that into the request?
//msgs.sort(sortChannelMsgSummary);
/* replace all the messages with new ones */
QList<GxsChannelPostItem *>::iterator mit;
for (mit = mChannelPostItems.begin(); mit != mChannelPostItems.end(); mit++) {
delete (*mit);
}
mChannelPostItems.clear();
uint32_t subscribeFlags = 0xffffffff;
for (it = posts.begin(); it != posts.end(); it++)
{
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, *it, subscribeFlags, true);
mChannelPostItems.push_back(item);
ui.verticalLayout->addWidget(item);
}
}

View file

@ -22,14 +22,9 @@
#ifndef _GXS_CHANNEL_DIALOG_H #ifndef _GXS_CHANNEL_DIALOG_H
#define _GXS_CHANNEL_DIALOG_H #define _GXS_CHANNEL_DIALOG_H
#include <retroshare/rsgxschannels.h>
#include <QStandardItemModel>
#include <QThread>
#include <map> #include <map>
#include "mainpage.h" #include "gui/gxs/RsGxsUpdateBroadcastPage.h"
#include "RsAutoUpdatePage.h"
#include "ui_GxsChannelDialog.h" #include "ui_GxsChannelDialog.h"
@ -41,9 +36,9 @@
//class ChanMsgItem; //class ChanMsgItem;
class GxsChannelPostItem; class GxsChannelPostItem;
class QTreeWidgetItem; class QTreeWidgetItem;
class UIStateHelper;
class GxsChannelDialog : public RsAutoUpdatePage, public TokenResponse, public GxsServiceDialog, class GxsChannelDialog : public RsGxsUpdateBroadcastPage, public TokenResponse, public GxsServiceDialog, public FeedHolder
public FeedHolder
{ {
Q_OBJECT Q_OBJECT
@ -53,7 +48,7 @@ public:
/** Default Destructor */ /** Default Destructor */
~GxsChannelDialog(); ~GxsChannelDialog();
virtual UserNotify *getUserNotify(QObject *parent); // virtual UserNotify *getUserNotify(QObject *parent);
/* FeedHolder */ /* FeedHolder */
virtual QScrollArea *getScrollArea(); virtual QScrollArea *getScrollArea();
@ -63,15 +58,14 @@ public:
bool navigate(const std::string& channelId, const std::string& msgId); bool navigate(const std::string& channelId, const std::string& msgId);
/* overloaded from RsAuthUpdatePage */
virtual void updateDisplay();
/* NEW GXS FNS */ /* NEW GXS FNS */
void loadRequest(const TokenQueue *queue, const TokenRequest &req); void loadRequest(const TokenQueue *queue, const TokenRequest &req);
protected:
virtual void updateDisplay(bool complete);
private slots: private slots:
void todo();
void channelListCustomPopupMenu(QPoint point); void channelListCustomPopupMenu(QPoint point);
void selectChannel(const QString &id); void selectChannel(const QString &id);
@ -90,18 +84,13 @@ private slots:
void shareKey(); void shareKey();
void copyChannelLink(); void copyChannelLink();
void channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status); // void channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status);
//void generateMassData(); //void generateMassData();
//void fillThreadFinished(); //void fillThreadFinished();
//void fillThreadAddMsg(const QString &channelId, const QString &channelMsgId, int current, int count); //void fillThreadAddMsg(const QString &channelId, const QString &channelMsgId, int current, int count);
/* NEW GXS FNS */
void forceUpdateDisplay();
private: private:
//void updateChannelList(); //void updateChannelList();
//void updateChannelMsgs(); //void updateChannelMsgs();
@ -134,7 +123,6 @@ private:
std::string mChannelId; /* current Channel */ std::string mChannelId; /* current Channel */
TokenQueue *mChannelQueue; TokenQueue *mChannelQueue;
/* Layout Pointers */ /* Layout Pointers */
QBoxLayout *mMsgLayout; QBoxLayout *mMsgLayout;
@ -148,6 +136,8 @@ private:
QTreeWidgetItem *popularChannels; QTreeWidgetItem *popularChannels;
QTreeWidgetItem *otherChannels; QTreeWidgetItem *otherChannels;
UIStateHelper *mStateHelper;
/* UI - from Designer */ /* UI - from Designer */
Ui::GxsChannelDialog ui; Ui::GxsChannelDialog ui;
}; };

View file

@ -54,7 +54,7 @@
<string/> <string/>
</property> </property>
<property name="pixmap"> <property name="pixmap">
<pixmap>:/images/channels32.png</pixmap> <pixmap resource="../images.qrc">:/images/channels32.png</pixmap>
</property> </property>
<property name="scaledContents"> <property name="scaledContents">
<bool>true</bool> <bool>true</bool>
@ -89,9 +89,9 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QPushButton" name="refreshButton"> <widget class="QPushButton" name="todoPushButton">
<property name="text"> <property name="text">
<string>refresh</string> <string>Todo</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -104,7 +104,7 @@
<string>Display</string> <string>Display</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset> <iconset resource="../images.qrc">
<normaloff>:/images/looknfeel.png</normaloff>:/images/looknfeel.png</iconset> <normaloff>:/images/looknfeel.png</normaloff>:/images/looknfeel.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
@ -133,7 +133,7 @@
<string>Create Channel</string> <string>Create Channel</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset> <iconset resource="../images.qrc">
<normaloff>:/images/add_channel24.png</normaloff>:/images/add_channel24.png</iconset> <normaloff>:/images/add_channel24.png</normaloff>:/images/add_channel24.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
@ -194,7 +194,7 @@
<string/> <string/>
</property> </property>
<property name="pixmap"> <property name="pixmap">
<pixmap>:/images/channels.png</pixmap> <pixmap resource="../images.qrc">:/images/channels.png</pixmap>
</property> </property>
<property name="scaledContents"> <property name="scaledContents">
<bool>true</bool> <bool>true</bool>
@ -236,7 +236,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>380</width> <width>362</width>
<height>16</height> <height>16</height>
</rect> </rect>
</property> </property>
@ -299,7 +299,7 @@
<string>Post to Channel</string> <string>Post to Channel</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset> <iconset resource="../images.qrc">
<normaloff>:/images/mail_send.png</normaloff>:/images/mail_send.png</iconset> <normaloff>:/images/mail_send.png</normaloff>:/images/mail_send.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
@ -360,7 +360,7 @@
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="images.qrc"/> <include location="../images.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View file

@ -309,9 +309,9 @@ void GxsForumThreadWidget::changeEvent(QEvent *e)
} }
} }
void GxsForumThreadWidget::updateDisplay(bool initialFill) void GxsForumThreadWidget::updateDisplay(bool complete)
{ {
if (initialFill) { if (complete) {
/* Not needed */ /* Not needed */
return; return;
} }

View file

@ -61,7 +61,7 @@ signals:
protected: protected:
bool eventFilter(QObject *obj, QEvent *ev); bool eventFilter(QObject *obj, QEvent *ev);
void changeEvent(QEvent *e); void changeEvent(QEvent *e);
virtual void updateDisplay(bool initialFill); virtual void updateDisplay(bool complete);
private slots: private slots:
/** Create the context popup menu and it's submenus */ /** Create the context popup menu and it's submenus */

View file

@ -257,11 +257,13 @@ void GxsForumsDialog::restoreForumKeys(void)
#endif #endif
} }
void GxsForumsDialog::updateDisplay(bool /*initialFill*/) void GxsForumsDialog::updateDisplay(bool complete)
{ {
if (complete || !getGrpIds().empty()) {
/* Update forums list */ /* Update forums list */
insertForums(); insertForums();
} }
}
void GxsForumsDialog::forumInfoToGroupItemInfo(const RsGroupMetaData &forumInfo, GroupItemInfo &groupItemInfo) void GxsForumsDialog::forumInfoToGroupItemInfo(const RsGroupMetaData &forumInfo, GroupItemInfo &groupItemInfo)
{ {

View file

@ -55,7 +55,7 @@ public:
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req); virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
protected: protected:
virtual void updateDisplay(bool initialFill); virtual void updateDisplay(bool complete);
private slots: private slots:
void settingsChanged(); void settingsChanged();

View file

@ -5039,10 +5039,6 @@ p, li { white-space: pre-wrap; }
<source>Message Group</source> <source>Message Group</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Add Friend</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Edit Group</source> <source>Edit Group</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -5051,10 +5047,6 @@ p, li { white-space: pre-wrap; }
<source>Remove Group</source> <source>Remove Group</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Chat lobbies</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Chat</source> <source>Chat</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -5071,10 +5063,6 @@ p, li { white-space: pre-wrap; }
<source>Recommend this Friend to...</source> <source>Recommend this Friend to...</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Connect To Friend</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Copy certificate link</source> <source>Copy certificate link</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -5115,26 +5103,6 @@ p, li { white-space: pre-wrap; }
<source>Remove from all groups</source> <source>Remove from all groups</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Create new</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Invite this group</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Invite this friend</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unsubscribe</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Expand all</source> <source>Expand all</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -5151,22 +5119,10 @@ p, li { white-space: pre-wrap; }
<source>Do you want to remove this Friend?</source> <source>Do you want to remove this Friend?</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Unsubscribe to lobby</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>You are about to unsubscribe a chat lobby&lt;br&gt;You can only re-enter if your friends invite you again.</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Columns</source> <source>Columns</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Sort by</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>IP</source> <source>IP</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -5179,6 +5135,22 @@ p, li { white-space: pre-wrap; }
<source>Show IP Column</source> <source>Show IP Column</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Attempt to connect</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Create new group</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Recommend many friends to each others</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Service permissions matrix</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>FriendRecommendDialog</name> <name>FriendRecommendDialog</name>
@ -5255,10 +5227,6 @@ p, li { white-space: pre-wrap; }
<source>Display</source> <source>Display</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Add</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Edit status message</source> <source>Edit status message</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -5375,10 +5343,6 @@ p, li { white-space: pre-wrap; }
<source>Local network</source> <source>Local network</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Known people</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Welcome to RetroShare&apos;s group chat.</source> <source>Welcome to RetroShare&apos;s group chat.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -5411,6 +5375,10 @@ p, li { white-space: pre-wrap; }
<source>Text File (*.txt );;All Files (*)</source> <source>Text File (*.txt );;All Files (*)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Keyring</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>GamesDialog</name> <name>GamesDialog</name>
@ -6254,10 +6222,6 @@ p, li { white-space: pre-wrap; }
<source>Channels</source> <source>Channels</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>refresh</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Display</source> <source>Display</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -6350,6 +6314,10 @@ p, li { white-space: pre-wrap; }
<source>No Channel Selected</source> <source>No Channel Selected</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Todo</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>GxsChannelGroupDialog</name> <name>GxsChannelGroupDialog</name>
@ -8902,10 +8870,6 @@ Do you want to save message ?</source>
<source>Search Network</source> <source>Search Network</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Show all accessible keys</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Name</source> <source>Name</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -9112,6 +9076,10 @@ Right-click and select &apos;make friend&apos; to be able to connect.</source>
<source>Data inconsistency in the keyring. This is most probably a bug. Please contact the developers.</source> <source>Data inconsistency in the keyring. This is most probably a bug. Please contact the developers.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Only show people you trusted</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>NetworkPage</name> <name>NetworkPage</name>
@ -9176,6 +9144,10 @@ Right-click and select &apos;make friend&apos; to be able to connect.</source>
<source>This is a test.</source> <source>This is a test.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source> &lt;h1&gt;&lt;img width=&quot;32&quot; src=&quot;:/images/64px_help.png&quot;&gt;&amp;nbsp;&amp;nbsp;News Feed&lt;/h1&gt; &lt;p&gt;The News Feed displays the last events on your network, sorted by the time you received them. This gives you a summary of the activity of your friends. You can configure which events to show by pressing on &lt;b&gt;Options&lt;/b&gt;. &lt;/p&gt; &lt;p&gt;The various events shown are: &lt;ul&gt; &lt;li&gt;Connection attempts (useful to make friends with new people and control who&apos;s trying to reach you)&lt;/li&gt; &lt;li&gt;Channel and Forum posts&lt;/li&gt; &lt;li&gt;New Channels and Forums you can subscribe to&lt;/li&gt; &lt;li&gt;Private messages from your friends&lt;/li&gt; &lt;/ul&gt; &lt;/p&gt; </source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>NotifyPage</name> <name>NotifyPage</name>