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); 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)) if (groupId().isNull() || !IS_GROUP_SUBSCRIBED(mGroup.mMeta.mSubscribeFlags))
return; return;

View File

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

View File

@ -28,7 +28,6 @@ GxsMessageFrameWidget::GxsMessageFrameWidget(RsGxsIfaceHelper *ifaceImpl, QWidge
{ {
mNextTokenType = 0; mNextTokenType = 0;
mTokenQueue = new TokenQueue(ifaceImpl->getTokenService(), this);
mStateHelper = new UIStateHelper(this); mStateHelper = new UIStateHelper(this);
/* Set read status */ /* Set read status */
@ -46,8 +45,6 @@ GxsMessageFrameWidget::~GxsMessageFrameWidget()
emit waitingChanged(this); emit waitingChanged(this);
} }
delete(mTokenQueue);
} }
const RsGxsGroupId &GxsMessageFrameWidget::groupId() const RsGxsGroupId &GxsMessageFrameWidget::groupId()
@ -95,34 +92,6 @@ void GxsMessageFrameWidget::setGroupId(const RsGxsGroupId &groupId)
void GxsMessageFrameWidget::setAllMessagesRead(bool read) void GxsMessageFrameWidget::setAllMessagesRead(bool read)
{ {
uint32_t token = 0; setAllMessagesReadDo(read);
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);
}
} }
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 #define GXSMESSAGEFRAMEWIDGET_H
#include "gui/gxs/RsGxsUpdateBroadcastWidget.h" #include "gui/gxs/RsGxsUpdateBroadcastWidget.h"
#include "util/TokenQueue.h"
struct RsGxsIfaceHelper; struct RsGxsIfaceHelper;
class UIStateHelper; class UIStateHelper;
class GxsMessageFrameWidget : public QWidget, public TokenResponse class GxsMessageFrameWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
@ -49,7 +48,6 @@ public:
/* GXS functions */ /* GXS functions */
uint32_t nextTokenType() { return ++mNextTokenType; } uint32_t nextTokenType() { return ++mNextTokenType; }
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
signals: signals:
void groupChanged(QWidget *widget); void groupChanged(QWidget *widget);
@ -58,10 +56,9 @@ signals:
void groupDataLoaded(); void groupDataLoaded();
protected: protected:
virtual void setAllMessagesReadDo(bool read, uint32_t &token) = 0; virtual void setAllMessagesReadDo(bool read) = 0;
protected: protected:
TokenQueue *mTokenQueue;
UIStateHelper *mStateHelper; UIStateHelper *mStateHelper;
/* Set read status */ /* Set read status */

View File

@ -1432,7 +1432,7 @@ public:
uint32_t mLastToken; 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)) if (groupId().isNull() || !IS_GROUP_SUBSCRIBED(mGroup.mMeta.mSubscribeFlags))
return; return;

View File

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

View File

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

View File

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