removed TokenQueue from GxsMessageFrameWidget

This commit is contained in:
csoler 2022-06-22 15:43:57 +02:00
parent 6411d5507f
commit 819dc173e0
8 changed files with 9 additions and 43 deletions

View File

@ -773,7 +773,7 @@ QIcon PostedListWidgetWithModel::groupIcon()
return QIcon(postedImage);
}
void PostedListWidgetWithModel::setAllMessagesReadDo(bool read, uint32_t &/*token*/)
void PostedListWidgetWithModel::setAllMessagesReadDo(bool read)
{
if (groupId().isNull() || !IS_GROUP_SUBSCRIBED(mGroup.mMeta.mSubscribeFlags))
return;

View File

@ -130,7 +130,7 @@ protected:
#endif
/* GxsMessageFrameWidget */
virtual void setAllMessagesReadDo(bool read, uint32_t &token) override;
virtual void setAllMessagesReadDo(bool read) override;
private slots:
#ifdef TO_REMOVE

View File

@ -28,7 +28,6 @@ GxsMessageFrameWidget::GxsMessageFrameWidget(RsGxsIfaceHelper *ifaceImpl, QWidge
{
mNextTokenType = 0;
mTokenQueue = new TokenQueue(ifaceImpl->getTokenService(), this);
mStateHelper = new UIStateHelper(this);
/* Set read status */
@ -46,8 +45,6 @@ GxsMessageFrameWidget::~GxsMessageFrameWidget()
emit waitingChanged(this);
}
delete(mTokenQueue);
}
const RsGxsGroupId &GxsMessageFrameWidget::groupId()
@ -95,34 +92,6 @@ void GxsMessageFrameWidget::setGroupId(const RsGxsGroupId &groupId)
void GxsMessageFrameWidget::setAllMessagesRead(bool read)
{
uint32_t token = 0;
setAllMessagesReadDo(read, token);
if (token) {
/* Wait for acknowlegde of the token */
mAcknowledgeReadStatusToken = token;
mTokenQueue->queueRequest(mAcknowledgeReadStatusToken, 0, 0, mTokenTypeAcknowledgeReadStatus);
mStateHelper->setLoading(mTokenTypeAcknowledgeReadStatus, true);
emit waitingChanged(this);
}
setAllMessagesReadDo(read);
}
void GxsMessageFrameWidget::loadRequest(const TokenQueue *queue, const TokenRequest &req)
{
if (queue == mTokenQueue)
{
if (req.mUserType == mTokenTypeAcknowledgeReadStatus) {
if (mAcknowledgeReadStatusToken == req.mToken) {
/* Set read status is finished */
mStateHelper->setLoading(mTokenTypeAcknowledgeReadStatus, false);
emit waitingChanged(this);
}
return;
}
}
std::cerr << "GxsMessageFrameWidget::loadRequest() ERROR: INVALID TYPE";
std::cerr << std::endl;
}

View File

@ -22,12 +22,11 @@
#define GXSMESSAGEFRAMEWIDGET_H
#include "gui/gxs/RsGxsUpdateBroadcastWidget.h"
#include "util/TokenQueue.h"
struct RsGxsIfaceHelper;
class UIStateHelper;
class GxsMessageFrameWidget : public QWidget, public TokenResponse
class GxsMessageFrameWidget : public QWidget
{
Q_OBJECT
@ -49,7 +48,6 @@ public:
/* GXS functions */
uint32_t nextTokenType() { return ++mNextTokenType; }
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
signals:
void groupChanged(QWidget *widget);
@ -58,10 +56,9 @@ signals:
void groupDataLoaded();
protected:
virtual void setAllMessagesReadDo(bool read, uint32_t &token) = 0;
virtual void setAllMessagesReadDo(bool read) = 0;
protected:
TokenQueue *mTokenQueue;
UIStateHelper *mStateHelper;
/* Set read status */

View File

@ -1432,7 +1432,7 @@ public:
uint32_t mLastToken;
};
void GxsChannelPostsWidgetWithModel::setAllMessagesReadDo(bool read, uint32_t& /*token*/)
void GxsChannelPostsWidgetWithModel::setAllMessagesReadDo(bool read)
{
if (groupId().isNull() || !IS_GROUP_SUBSCRIBED(mGroup.mMeta.mSubscribeFlags))
return;

View File

@ -137,7 +137,7 @@ protected:
#endif
/* GxsMessageFrameWidget */
virtual void setAllMessagesReadDo(bool read, uint32_t &token) override;
virtual void setAllMessagesReadDo(bool read) override;
private slots:
void showPostDetails();

View File

@ -1503,7 +1503,7 @@ void GxsForumThreadWidget::markMsgAsUnreadChildren()
markMsgAsReadUnread(false, true, false);
}
void GxsForumThreadWidget::setAllMessagesReadDo(bool read, uint32_t &/*token*/)
void GxsForumThreadWidget::setAllMessagesReadDo(bool read)
{
markMsgAsReadUnread(read, true, true);
}

View File

@ -102,7 +102,7 @@ protected:
virtual void updateDisplay(bool complete);
/* GxsMessageFrameWidget */
virtual void setAllMessagesReadDo(bool read, uint32_t &token);
virtual void setAllMessagesReadDo(bool read);
void setMessageLoadingError(const QString& error);
private slots: