2018-11-14 15:14:40 -05:00
|
|
|
/*******************************************************************************
|
|
|
|
* retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h *
|
|
|
|
* *
|
|
|
|
* Copyright 2012-2013 by Robert Fernie <retroshare.project@gmail.com> *
|
|
|
|
* *
|
|
|
|
* This program is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU Affero General Public License as *
|
|
|
|
* published by the Free Software Foundation, either version 3 of the *
|
|
|
|
* License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program 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 Affero General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Affero General Public License *
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
|
|
|
* *
|
|
|
|
*******************************************************************************/
|
2014-05-04 18:59:06 -04:00
|
|
|
|
|
|
|
#ifndef _GXSGROUPFRAMEDIALOG_H
|
|
|
|
#define _GXSGROUPFRAMEDIALOG_H
|
|
|
|
|
|
|
|
#include "gui/gxs/RsGxsUpdateBroadcastPage.h"
|
|
|
|
#include "RsAutoUpdatePage.h"
|
2014-05-27 17:14:05 -04:00
|
|
|
#include "gui/RetroShareLink.h"
|
2014-07-24 10:54:23 -04:00
|
|
|
#include "gui/settings/rsharesettings.h"
|
2014-09-11 18:07:06 -04:00
|
|
|
#include "util/RsUserdata.h"
|
2014-05-04 18:59:06 -04:00
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
|
|
|
|
#include "util/TokenQueue.h"
|
|
|
|
#include "GxsIdTreeWidgetItem.h"
|
|
|
|
#include "GxsGroupDialog.h"
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class GxsGroupFrameDialog;
|
|
|
|
}
|
|
|
|
|
|
|
|
class GroupTreeWidget;
|
|
|
|
class GroupItemInfo;
|
|
|
|
class GxsMessageFrameWidget;
|
2014-05-07 17:04:54 -04:00
|
|
|
class UIStateHelper;
|
2014-05-07 20:00:21 -04:00
|
|
|
class RsGxsCommentService;
|
|
|
|
class GxsCommentDialog;
|
2014-05-04 18:59:06 -04:00
|
|
|
|
|
|
|
class GxsGroupFrameDialog : public RsGxsUpdateBroadcastPage, public TokenResponse
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum TextType {
|
|
|
|
TEXT_NAME,
|
|
|
|
TEXT_NEW,
|
|
|
|
TEXT_TODO,
|
|
|
|
TEXT_YOUR_GROUP,
|
|
|
|
TEXT_SUBSCRIBED_GROUP,
|
|
|
|
TEXT_POPULAR_GROUP,
|
|
|
|
TEXT_OTHER_GROUP
|
|
|
|
};
|
|
|
|
|
|
|
|
enum IconType {
|
|
|
|
ICON_NAME,
|
|
|
|
ICON_NEW,
|
|
|
|
ICON_YOUR_GROUP,
|
|
|
|
ICON_SUBSCRIBED_GROUP,
|
|
|
|
ICON_POPULAR_GROUP,
|
|
|
|
ICON_OTHER_GROUP,
|
2018-06-20 16:30:44 -04:00
|
|
|
ICON_SEARCH,
|
2014-05-04 18:59:06 -04:00
|
|
|
ICON_DEFAULT
|
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
2018-07-05 08:00:04 -04:00
|
|
|
GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, QWidget *parent = 0,bool allow_dist_sync=false);
|
2014-09-10 17:38:43 -04:00
|
|
|
virtual ~GxsGroupFrameDialog();
|
2014-05-04 18:59:06 -04:00
|
|
|
|
2014-10-25 11:50:00 -04:00
|
|
|
bool navigate(const RsGxsGroupId &groupId, const RsGxsMessageId& msgId);
|
2014-05-04 18:59:06 -04:00
|
|
|
|
|
|
|
// Callback for all Loads.
|
|
|
|
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
|
|
|
|
2014-09-10 17:38:43 -04:00
|
|
|
virtual QString getHelpString() const =0;
|
|
|
|
|
2018-07-05 04:11:12 -04:00
|
|
|
virtual void getGroupList(std::map<RsGxsGroupId,RsGroupMetaData> &groups) ;
|
2017-10-21 15:23:40 -04:00
|
|
|
|
2014-05-04 18:59:06 -04:00
|
|
|
protected:
|
|
|
|
virtual void showEvent(QShowEvent *event);
|
|
|
|
virtual void updateDisplay(bool complete);
|
|
|
|
|
2015-03-13 15:33:37 -04:00
|
|
|
const RsGxsGroupId &groupId() { return mGroupId; }
|
2014-05-04 18:59:06 -04:00
|
|
|
void setSingleTab(bool singleTab);
|
2014-07-14 17:29:51 -04:00
|
|
|
void setHideTabBarWithOneTab(bool hideTabBarWithOneTab);
|
2014-07-24 10:54:23 -04:00
|
|
|
bool getCurrentGroupName(QString& name);
|
|
|
|
virtual RetroShareLink::enumType getLinkType() = 0;
|
|
|
|
virtual GroupFrameSettings::Type groupFrameSettingsType() { return GroupFrameSettings::Nothing; }
|
2014-09-11 18:07:06 -04:00
|
|
|
virtual void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata);
|
2018-07-04 17:54:26 -04:00
|
|
|
virtual void checkRequestGroup(const RsGxsGroupId& /* grpId */) {} // overload this one in order to retrieve full group data when the group is browsed
|
2014-05-04 18:59:06 -04:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void todo();
|
|
|
|
|
|
|
|
/** Create the context popup menu and it's submenus */
|
|
|
|
void groupTreeCustomPopupMenu(QPoint point);
|
2014-07-24 10:54:23 -04:00
|
|
|
void settingsChanged();
|
2016-12-05 16:14:48 -05:00
|
|
|
void setSyncPostsDelay();
|
|
|
|
void setStorePostsDelay();
|
2014-05-04 18:59:06 -04:00
|
|
|
|
|
|
|
void restoreGroupKeys();
|
|
|
|
void newGroup();
|
2018-07-05 05:43:55 -04:00
|
|
|
void distantRequestGroupData();
|
2014-05-04 18:59:06 -04:00
|
|
|
|
2018-06-21 03:26:03 -04:00
|
|
|
void changedCurrentGroup(const QString &groupId);
|
2014-05-04 18:59:06 -04:00
|
|
|
void groupTreeMiddleButtonClicked(QTreeWidgetItem *item);
|
|
|
|
void openInNewTab();
|
|
|
|
void messageTabCloseRequested(int index);
|
|
|
|
void messageTabChanged(int index);
|
|
|
|
void messageTabInfoChanged(QWidget *widget);
|
2015-03-14 17:13:28 -04:00
|
|
|
void messageTabWaitingChanged(QWidget *widget);
|
2014-05-04 18:59:06 -04:00
|
|
|
|
|
|
|
void copyGroupLink();
|
|
|
|
|
|
|
|
void subscribeGroup();
|
|
|
|
void unsubscribeGroup();
|
|
|
|
|
|
|
|
void showGroupDetails();
|
|
|
|
void editGroupDetails();
|
|
|
|
|
|
|
|
void markMsgAsRead();
|
|
|
|
void markMsgAsUnread();
|
|
|
|
|
2016-06-16 22:23:27 -04:00
|
|
|
void sharePublishKey();
|
2014-05-04 18:59:06 -04:00
|
|
|
|
2017-05-18 16:31:52 -04:00
|
|
|
void loadComment(const RsGxsGroupId &grpId, const QVector<RsGxsMessageId>& msg_versions,const RsGxsMessageId &most_recent_msgId, const QString &title);
|
2018-06-20 17:26:37 -04:00
|
|
|
|
2018-06-20 16:30:44 -04:00
|
|
|
void searchNetwork(const QString &search_string) ;
|
2018-06-20 17:26:37 -04:00
|
|
|
void removeAllSearches();
|
|
|
|
void removeCurrentSearch();
|
2014-05-07 20:00:21 -04:00
|
|
|
|
2014-05-04 18:59:06 -04:00
|
|
|
private:
|
|
|
|
virtual QString text(TextType type) = 0;
|
|
|
|
virtual QString icon(IconType type) = 0;
|
|
|
|
virtual QString settingsGroupName() = 0;
|
2018-06-20 16:30:44 -04:00
|
|
|
virtual TurtleRequestId distantSearch(const QString& search_string) ;
|
2014-05-27 17:14:05 -04:00
|
|
|
|
2014-05-04 18:59:06 -04:00
|
|
|
virtual GxsGroupDialog *createNewGroupDialog(TokenQueue *tokenQueue) = 0;
|
|
|
|
virtual GxsGroupDialog *createGroupDialog(TokenQueue *tokenQueue, RsTokenService *tokenService, GxsGroupDialog::Mode mode, RsGxsGroupId groupId) = 0;
|
|
|
|
virtual int shareKeyType() = 0;
|
|
|
|
virtual GxsMessageFrameWidget *createMessageFrameWidget(const RsGxsGroupId &groupId) = 0;
|
|
|
|
virtual void groupTreeCustomActions(RsGxsGroupId /*grpId*/, int /*subscribeFlags*/, QList<QAction*> &/*actions*/) {}
|
2014-05-07 20:00:21 -04:00
|
|
|
virtual RsGxsCommentService *getCommentService() { return NULL; }
|
|
|
|
virtual QWidget *createCommentHeaderWidget(const RsGxsGroupId &/*grpId*/, const RsGxsMessageId &/*msgId*/) { return NULL; }
|
2018-07-04 17:54:26 -04:00
|
|
|
virtual bool getDistantSearchResults(TurtleRequestId /* id */, std::map<RsGxsGroupId,RsGxsGroupSummary>& /* group_infos */){ return false ;}
|
2014-05-04 18:59:06 -04:00
|
|
|
|
|
|
|
void initUi();
|
|
|
|
|
|
|
|
void updateMessageSummaryList(RsGxsGroupId groupId);
|
2018-06-23 16:25:36 -04:00
|
|
|
void updateSearchResults();
|
2014-05-04 18:59:06 -04:00
|
|
|
|
|
|
|
void openGroupInNewTab(const RsGxsGroupId &groupId);
|
|
|
|
void groupSubscribe(bool subscribe);
|
|
|
|
|
|
|
|
void processSettings(bool load);
|
|
|
|
|
|
|
|
// New Request/Response Loading Functions.
|
2018-07-05 04:11:12 -04:00
|
|
|
void insertGroupsData(const std::map<RsGxsGroupId, RsGroupMetaData> &groupList, const RsUserdata *userdata);
|
2014-05-04 18:59:06 -04:00
|
|
|
|
|
|
|
void requestGroupSummary();
|
|
|
|
void loadGroupSummary(const uint32_t &token);
|
2014-09-11 18:07:06 -04:00
|
|
|
virtual uint32_t requestGroupSummaryType() { return GXS_REQUEST_TYPE_GROUP_META; } // request only meta data
|
|
|
|
virtual void loadGroupSummaryToken(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo, RsUserdata* &userdata); // use with requestGroupSummaryType
|
2014-05-04 18:59:06 -04:00
|
|
|
|
2014-07-20 15:35:33 -04:00
|
|
|
void requestGroupStatistics(const RsGxsGroupId &groupId);
|
2014-07-06 12:39:09 -04:00
|
|
|
void loadGroupStatistics(const uint32_t &token);
|
|
|
|
|
2014-05-04 18:59:06 -04:00
|
|
|
// subscribe/unsubscribe ack.
|
2014-07-05 14:33:11 -04:00
|
|
|
// void acknowledgeSubscribeChange(const uint32_t &token);
|
2014-05-04 18:59:06 -04:00
|
|
|
|
|
|
|
GxsMessageFrameWidget *messageWidget(const RsGxsGroupId &groupId, bool ownTab);
|
|
|
|
GxsMessageFrameWidget *createMessageWidget(const RsGxsGroupId &groupId);
|
|
|
|
|
2014-05-07 20:00:21 -04:00
|
|
|
GxsCommentDialog *commentWidget(const RsGxsMessageId &msgId);
|
|
|
|
|
2014-05-04 18:59:06 -04:00
|
|
|
// void requestGroupSummary_CurrentGroup(const RsGxsGroupId &groupId);
|
|
|
|
// void loadGroupSummary_CurrentGroup(const uint32_t &token);
|
|
|
|
|
2014-09-24 19:57:47 -04:00
|
|
|
protected:
|
|
|
|
bool mCountChildMsgs; // Count unread child messages?
|
|
|
|
|
2014-05-04 18:59:06 -04:00
|
|
|
private:
|
|
|
|
bool mInitialized;
|
2015-08-26 08:51:34 -04:00
|
|
|
bool mInFill;
|
2018-07-05 08:00:04 -04:00
|
|
|
bool mDistSyncAllowed;
|
2014-05-04 18:59:06 -04:00
|
|
|
QString mSettingsName;
|
|
|
|
RsGxsGroupId mGroupId;
|
|
|
|
RsGxsIfaceHelper *mInterface;
|
2014-07-20 15:35:33 -04:00
|
|
|
RsTokenService *mTokenService;
|
2014-05-04 18:59:06 -04:00
|
|
|
TokenQueue *mTokenQueue;
|
|
|
|
GxsMessageFrameWidget *mMessageWidget;
|
|
|
|
|
|
|
|
QTreeWidgetItem *mYourGroups;
|
|
|
|
QTreeWidgetItem *mSubscribedGroups;
|
|
|
|
QTreeWidgetItem *mPopularGroups;
|
|
|
|
QTreeWidgetItem *mOtherGroups;
|
|
|
|
|
2014-10-25 11:50:00 -04:00
|
|
|
RsGxsGroupId mNavigatePendingGroupId;
|
|
|
|
RsGxsMessageId mNavigatePendingMsgId;
|
|
|
|
|
2014-05-07 17:04:54 -04:00
|
|
|
UIStateHelper *mStateHelper;
|
2014-05-04 18:59:06 -04:00
|
|
|
|
|
|
|
/** Qt Designer generated object */
|
|
|
|
Ui::GxsGroupFrameDialog *ui;
|
2017-10-21 15:23:40 -04:00
|
|
|
|
2018-07-05 04:11:12 -04:00
|
|
|
std::map<RsGxsGroupId,RsGroupMetaData> mCachedGroupMetas;
|
2018-06-20 16:30:44 -04:00
|
|
|
|
2018-06-24 17:15:22 -04:00
|
|
|
std::map<uint32_t,QTreeWidgetItem*> mSearchGroupsItems ;
|
|
|
|
std::map<uint32_t,std::set<RsGxsGroupId> > mKnownGroups;
|
2014-05-04 18:59:06 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|