mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-03-31 11:08:16 -04:00
Posted:
- Used GxsGroupFrameDialog - Added tabbed interface - Added user notify git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7464 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c6103b7535
commit
30fcab1bff
@ -412,9 +412,7 @@ void MainWindow::initStackedPage()
|
||||
//notify.push_back(QPair<MainPage*, QAction*>(gxsforumDialog, action));
|
||||
addPage(gxsforumDialog = new GxsForumsDialog(ui->stackPages), grp, ¬ify);
|
||||
|
||||
PostedDialog *postedDialog = NULL;
|
||||
addPage(postedDialog = new PostedDialog(ui->stackPages), grp, ¬ify);
|
||||
postedDialog->setup();
|
||||
|
||||
WikiDialog *wikiDialog = NULL;
|
||||
addPage(wikiDialog = new WikiDialog(ui->stackPages), grp, ¬ify);
|
||||
@ -960,6 +958,9 @@ void SetForegroundWindowInternal(HWND hWnd)
|
||||
Page = _instance->blogsFeed;
|
||||
return true ;
|
||||
#endif
|
||||
case Posted:
|
||||
_instance->ui->stackPages->setCurrentPage( _instance->postedDialog );
|
||||
return true ;
|
||||
default:
|
||||
std::cerr << "Show page called on value that is not handled yet. Please code it! (value = " << page << ")" << std::endl;
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ class ToasterDisable;
|
||||
//class ForumsDialog;
|
||||
class GxsChannelDialog ;
|
||||
class GxsForumsDialog ;
|
||||
class PostedDialog;
|
||||
class FriendsDialog;
|
||||
class ChatLobbyWidget;
|
||||
class ChatDialog;
|
||||
@ -98,7 +99,8 @@ public:
|
||||
#endif
|
||||
#ifdef RS_USE_LINKS
|
||||
Links = 10, /** Links page. */
|
||||
#endif
|
||||
#endif
|
||||
Posted = 11, /** Posted links */
|
||||
};
|
||||
|
||||
/** Create main window */
|
||||
@ -137,6 +139,7 @@ public:
|
||||
SharedFilesDialog *sharedfilesDialog;
|
||||
GxsChannelDialog *gxschannelDialog ;
|
||||
GxsForumsDialog *gxsforumDialog ;
|
||||
PostedDialog *postedDialog;
|
||||
|
||||
// ForumsDialog *forumsDialog;
|
||||
// ChannelFeed *channelFeed;
|
||||
|
@ -45,6 +45,8 @@ PostedCreatePostDialog::PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted *pos
|
||||
ui->headerFrame->setHeaderImage(QPixmap(":/images/posted_64.png"));
|
||||
ui->headerFrame->setHeaderText(tr("Submit a new Post"));
|
||||
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
|
||||
/* fill in the available OwnIds for signing */
|
||||
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId());
|
||||
}
|
||||
|
135
retroshare-gui/src/gui/Posted/PostedDialog.cpp
Normal file
135
retroshare-gui/src/gui/Posted/PostedDialog.cpp
Normal file
@ -0,0 +1,135 @@
|
||||
/*
|
||||
* 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".
|
||||
*
|
||||
*/
|
||||
|
||||
#include "PostedDialog.h"
|
||||
#include "PostedItem.h"
|
||||
#include "PostedGroupDialog.h"
|
||||
#include "PostedListWidget.h"
|
||||
#include "PostedUserNotify.h"
|
||||
//#include "gui/channels/ShareKey.h"
|
||||
//#include "gui/settings/rsharesettings.h"
|
||||
//#include "gui/notifyqt.h"
|
||||
|
||||
#include <retroshare/rsposted.h>
|
||||
|
||||
/** Constructor */
|
||||
PostedDialog::PostedDialog(QWidget *parent)
|
||||
: GxsGroupFrameDialog(rsPosted, parent)
|
||||
{
|
||||
// connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged()));
|
||||
|
||||
settingsChanged();
|
||||
}
|
||||
|
||||
PostedDialog::~PostedDialog()
|
||||
{
|
||||
}
|
||||
|
||||
UserNotify *PostedDialog::getUserNotify(QObject *parent)
|
||||
{
|
||||
return new PostedUserNotify(rsPosted, parent);
|
||||
}
|
||||
|
||||
QString PostedDialog::text(TextType type)
|
||||
{
|
||||
switch (type) {
|
||||
case TEXT_NAME:
|
||||
return tr("Posted Links");
|
||||
case TEXT_NEW:
|
||||
return tr("Create Topic");
|
||||
case TEXT_TODO:
|
||||
return "<b>Open points:</b><ul>"
|
||||
"<li>Subreddits/tag to posts support"
|
||||
"<li>Picture Support"
|
||||
"</ul>";
|
||||
|
||||
case TEXT_YOUR_GROUP:
|
||||
return tr("My Topics");
|
||||
case TEXT_SUBSCRIBED_GROUP:
|
||||
return tr("Subscribed Topics");
|
||||
case TEXT_POPULAR_GROUP:
|
||||
return tr("Popular Topics");
|
||||
case TEXT_OTHER_GROUP:
|
||||
return tr("Other Topics");
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
QString PostedDialog::icon(IconType type)
|
||||
{
|
||||
switch (type) {
|
||||
case ICON_NAME:
|
||||
return ":/images/posted_24.png";
|
||||
case ICON_NEW:
|
||||
return ":/images/posted_add_24.png";
|
||||
case ICON_YOUR_GROUP:
|
||||
return ":/images/folder16.png";
|
||||
case ICON_SUBSCRIBED_GROUP:
|
||||
return ":/images/folder_red.png";
|
||||
case ICON_POPULAR_GROUP:
|
||||
return ":/images/folder_green.png";
|
||||
case ICON_OTHER_GROUP:
|
||||
return ":/images/folder_yellow.png";
|
||||
case ICON_DEFAULT:
|
||||
return "";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
void PostedDialog::settingsChanged()
|
||||
{
|
||||
setSingleTab(true /*!Settings->getPostedOpenAllInNewTab()*/);
|
||||
setHideTabBarWithOneTab(true /*Settings->getPostedHideTabBarWithOneTab()*/);
|
||||
}
|
||||
|
||||
GxsGroupDialog *PostedDialog::createNewGroupDialog(TokenQueue *tokenQueue)
|
||||
{
|
||||
return new PostedGroupDialog(tokenQueue, this);
|
||||
}
|
||||
|
||||
GxsGroupDialog *PostedDialog::createGroupDialog(TokenQueue *tokenQueue, RsTokenService *tokenService, GxsGroupDialog::Mode mode, RsGxsGroupId groupId)
|
||||
{
|
||||
return new PostedGroupDialog(tokenQueue, tokenService, mode, groupId, this);
|
||||
}
|
||||
|
||||
int PostedDialog::shareKeyType()
|
||||
{
|
||||
return 0; //POSTED_KEY_SHARE;
|
||||
}
|
||||
|
||||
GxsMessageFrameWidget *PostedDialog::createMessageFrameWidget(const RsGxsGroupId &groupId)
|
||||
{
|
||||
return new PostedListWidget(groupId);
|
||||
}
|
||||
|
||||
RsGxsCommentService *PostedDialog::getCommentService()
|
||||
{
|
||||
return rsPosted;
|
||||
}
|
||||
|
||||
QWidget *PostedDialog::createCommentHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId)
|
||||
{
|
||||
return new PostedItem(NULL, 0, grpId, msgId, true);
|
||||
}
|
@ -24,56 +24,43 @@
|
||||
#ifndef MRK_POSTED_DIALOG_H
|
||||
#define MRK_POSTED_DIALOG_H
|
||||
|
||||
#include <retroshare/rsposted.h>
|
||||
#include "gui/gxs/GxsGroupFrameDialog.h"
|
||||
|
||||
#include "gui/gxs/GxsCommentContainer.h"
|
||||
#include "gui/Posted/PostedListDialog.h"
|
||||
#include "gui/Posted/PostedItem.h"
|
||||
#define IMAGE_POSTED ":/images/wikibook_32.png"
|
||||
|
||||
#define IMAGE_POSTED ":/images/wikibook_32.png"
|
||||
|
||||
class PostedDialog : public GxsCommentContainer
|
||||
class PostedDialog : public GxsGroupFrameDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PostedDialog(QWidget *parent = 0)
|
||||
:GxsCommentContainer(parent) { return; }
|
||||
/** Default Constructor */
|
||||
PostedDialog(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
~PostedDialog();
|
||||
|
||||
virtual QIcon iconPixmap() const { return QIcon(IMAGE_POSTED) ; } //MainPage
|
||||
virtual QString pageName() const { return tr("Posted") ; } //MainPage
|
||||
virtual QString helpText() const { return ""; } //MainPage
|
||||
virtual QIcon iconPixmap() const { return QIcon(IMAGE_POSTED) ; } //MainPage
|
||||
virtual QString pageName() const { return tr("Posted") ; } //MainPage
|
||||
virtual QString helpText() const { return ""; } //MainPage
|
||||
|
||||
virtual UserNotify *getUserNotify(QObject *parent);
|
||||
|
||||
virtual GxsServiceDialog *createServiceDialog()
|
||||
{
|
||||
return new PostedListDialog(this);
|
||||
}
|
||||
protected:
|
||||
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_UNKNOWN; }
|
||||
|
||||
virtual QString getServiceName()
|
||||
{
|
||||
return tr("Posted Links");
|
||||
}
|
||||
private slots:
|
||||
void settingsChanged();
|
||||
|
||||
virtual RsTokenService *getTokenService()
|
||||
{
|
||||
return rsPosted->getTokenService();
|
||||
}
|
||||
|
||||
virtual RsGxsCommentService *getCommentService()
|
||||
{
|
||||
return rsPosted;
|
||||
}
|
||||
|
||||
virtual QWidget *createHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId)
|
||||
{
|
||||
return new PostedItem(NULL, 0, grpId, msgId, true);
|
||||
}
|
||||
|
||||
virtual QPixmap getServicePixmap()
|
||||
{
|
||||
return QPixmap(":/images/posted_24.png");
|
||||
}
|
||||
private:
|
||||
/* GxsGroupFrameDialog */
|
||||
virtual QString text(TextType type);
|
||||
virtual QString icon(IconType type);
|
||||
virtual QString settingsGroupName() { return "PostedDialog"; }
|
||||
virtual GxsGroupDialog *createNewGroupDialog(TokenQueue *tokenQueue);
|
||||
virtual GxsGroupDialog *createGroupDialog(TokenQueue *tokenQueue, RsTokenService *tokenService, GxsGroupDialog::Mode mode, RsGxsGroupId groupId);
|
||||
virtual int shareKeyType();
|
||||
virtual GxsMessageFrameWidget *createMessageFrameWidget(const RsGxsGroupId &groupId);
|
||||
virtual RsGxsCommentService *getCommentService();
|
||||
virtual QWidget *createCommentHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,343 +0,0 @@
|
||||
<?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>756</width>
|
||||
<height>428</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="handleWidth">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<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="1" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="submitPostButton">
|
||||
<property name="text">
|
||||
<string>Submit a new Post</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="Posted_images.qrc">
|
||||
<normaloff>:/images/posted_24.png</normaloff>:/images/posted_24.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Todo</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="showLabel">
|
||||
<property name="text">
|
||||
<string>Showing 1-100</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="prevButton">
|
||||
<property name="text">
|
||||
<string>Prev</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="nextButton">
|
||||
<property name="text">
|
||||
<string>Next</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="sortGroup">
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="hotSortButton">
|
||||
<property name="text">
|
||||
<string>Hot</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="Posted_images.qrc">
|
||||
<normaloff>:/images/hot_24.png</normaloff>:/images/hot_24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoExclusive">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="newSortButton">
|
||||
<property name="text">
|
||||
<string>New</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="Posted_images.qrc">
|
||||
<normaloff>:/images/new_24.png</normaloff>:/images/new_24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoExclusive">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="topSortButton">
|
||||
<property name="text">
|
||||
<string>Top</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/vote_up.png</normaloff>:/images/vote_up.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="autoExclusive">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</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="periodComboBox">
|
||||
<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>
|
||||
<item>
|
||||
<widget class="GxsIdChooser" name="idChooser"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_NewId">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Create new Identity</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New ID</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/identity/identity_create_32.png</normaloff>:/images/identity/identity_create_32.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" 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>714</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>GxsIdChooser</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>gui/gxs/GxsIdChooser.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>GroupTreeWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/common/GroupTreeWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
<include location="Posted_images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
971
retroshare-gui/src/gui/Posted/PostedListWidget.cpp
Normal file
971
retroshare-gui/src/gui/Posted/PostedListWidget.cpp
Normal file
@ -0,0 +1,971 @@
|
||||
/*
|
||||
* 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 <QMessageBox>
|
||||
|
||||
#include "PostedListWidget.h"
|
||||
#include "ui_PostedListWidget.h"
|
||||
|
||||
#include "PostedCreatePostDialog.h"
|
||||
#include "PostedItem.h"
|
||||
#include "PostedUserTypes.h"
|
||||
#include "gui/Identity/IdDialog.h"
|
||||
#include "gui/common/UIStateHelper.h"
|
||||
|
||||
#include <retroshare/rsposted.h>
|
||||
|
||||
/*********************** **** **** **** ***********************/
|
||||
/** 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
|
||||
|
||||
/****************************************************************
|
||||
*/
|
||||
|
||||
// token types to deal with
|
||||
|
||||
#define POSTED_DEFAULT_LISTING_LENGTH 10
|
||||
#define POSTED_MAX_INDEX 10000
|
||||
|
||||
/** Constructor */
|
||||
PostedListWidget::PostedListWidget(const RsGxsGroupId &postedId, QWidget *parent)
|
||||
: GxsMessageFrameWidget(rsPosted, parent),
|
||||
ui(new Ui::PostedListWidget)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui->setupUi(this);
|
||||
|
||||
/* Setup UI helper */
|
||||
mStateHelper = new UIStateHelper(this);
|
||||
|
||||
// No progress yet
|
||||
// mStateHelper->addWidget(TOKEN_TYPE_POSTS, ui->loadingLabel, UISTATE_LOADING_VISIBLE);
|
||||
// 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);
|
||||
// mStateHelper->addWidget(TOKEN_TYPE_GROUP_DATA, ui->subscribeToolButton);
|
||||
|
||||
/* Setup Queue */
|
||||
mPostedQueue = new TokenQueue(rsPosted->getTokenService(), this);
|
||||
|
||||
mSubscribeFlags = 0;
|
||||
|
||||
connect(ui->hotSortButton, SIGNAL(clicked()), this, SLOT(getRankings()));
|
||||
connect(ui->newSortButton, SIGNAL(clicked()), this, SLOT(getRankings()));
|
||||
connect(ui->topSortButton, SIGNAL(clicked()), this, SLOT(getRankings()));
|
||||
connect(ui->nextButton, SIGNAL(clicked()), this, SLOT(showNext()));
|
||||
connect(ui->prevButton, SIGNAL(clicked()), this, SLOT(showPrev()));
|
||||
|
||||
connect(ui->toolButton_NewId, SIGNAL(clicked()), this, SLOT(createNewGxsId()));
|
||||
|
||||
// default sort method.
|
||||
mSortMethod = RsPosted::HotRankType;
|
||||
mLastSortMethod = RsPosted::TopRankType; // to be different.
|
||||
mPostIndex = 0;
|
||||
mPostShow = POSTED_DEFAULT_LISTING_LENGTH;
|
||||
|
||||
ui->hotSortButton->setChecked(true);
|
||||
|
||||
/* fill in the available OwnIds for signing */
|
||||
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId());
|
||||
|
||||
connect(ui->submitPostButton, SIGNAL(clicked()), this, SLOT(newPost()));
|
||||
|
||||
/* load settings */
|
||||
processSettings(true);
|
||||
|
||||
/* Initialize GUI */
|
||||
setGroupId(postedId);
|
||||
}
|
||||
|
||||
PostedListWidget::~PostedListWidget()
|
||||
{
|
||||
// save settings
|
||||
processSettings(false);
|
||||
}
|
||||
|
||||
void PostedListWidget::updateDisplay(bool complete)
|
||||
{
|
||||
std::cerr << "rsPosted->updateDisplay()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (complete) {
|
||||
/* Fill complete */
|
||||
requestGroupData();
|
||||
requestPosts();
|
||||
return;
|
||||
}
|
||||
|
||||
if (mPostedId.isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool updateGroup = false;
|
||||
|
||||
const std::list<RsGxsGroupId> &grpIdsMeta = getGrpIdsMeta();
|
||||
if (std::find(grpIdsMeta.begin(), grpIdsMeta.end(), mPostedId) != grpIdsMeta.end()) {
|
||||
updateGroup = true;
|
||||
}
|
||||
|
||||
const std::list<RsGxsGroupId> &grpIds = getGrpIds();
|
||||
if (!mPostedId.isNull() && std::find(grpIds.begin(), grpIds.end(), mPostedId) != grpIds.end()) {
|
||||
updateGroup = true;
|
||||
/* Do we need to fill all posts? */
|
||||
requestPosts();
|
||||
} else {
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgs;
|
||||
getAllMsgIds(msgs);
|
||||
if (!msgs.empty())
|
||||
{
|
||||
std::cerr << "rsPosted->msgsChanged():";
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::const_iterator mit;
|
||||
mit = msgs.find(mPostedId);
|
||||
if(mit != msgs.end())
|
||||
{
|
||||
std::cerr << "current Group -> updating Displayed Items";
|
||||
std::cerr << std::endl;
|
||||
updateDisplayedItems(mit->second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (updateGroup) {
|
||||
requestGroupData();
|
||||
}
|
||||
}
|
||||
|
||||
void PostedListWidget::processSettings(bool load)
|
||||
{
|
||||
// Settings->beginGroup(QString("PostedListWidget"));
|
||||
//
|
||||
// if (load) {
|
||||
// // load settings
|
||||
// } else {
|
||||
// // save settings
|
||||
// }
|
||||
//
|
||||
// Settings->endGroup();
|
||||
}
|
||||
|
||||
void PostedListWidget::setGroupId(const RsGxsGroupId &groupId)
|
||||
{
|
||||
if (mPostedId == groupId) {
|
||||
if (!groupId.isNull()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
mPostedId = groupId;
|
||||
mName = mPostedId.isNull () ? "" : tr("Loading");
|
||||
|
||||
emit groupChanged(this);
|
||||
|
||||
fillComplete();
|
||||
}
|
||||
|
||||
QString PostedListWidget::groupName(bool withUnreadCount)
|
||||
{
|
||||
QString name = mPostedId.isNull () ? tr("No name") : mName;
|
||||
|
||||
// if (withUnreadCount && mUnreadCount) {
|
||||
// name += QString(" (%1)").arg(mUnreadCount);
|
||||
// }
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
QIcon PostedListWidget::groupIcon()
|
||||
{
|
||||
// if (mStateHelper->isLoading(TOKEN_TYPE_GROUP_DATA) || mStateHelper->isLoading(TOKEN_TYPE_POSTS)) {
|
||||
// return QIcon(":/images/kalarm.png");
|
||||
// }
|
||||
|
||||
// if (mNewCount) {
|
||||
// return QIcon(":/images/message-state-new.png");
|
||||
// }
|
||||
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
/*****************************************************************************************/
|
||||
// Overloaded from FeedHolder.
|
||||
QScrollArea *PostedListWidget::getScrollArea()
|
||||
{
|
||||
return ui->scrollArea;
|
||||
}
|
||||
|
||||
void PostedListWidget::deleteFeedItem(QWidget */*item*/, uint32_t /*type*/)
|
||||
{
|
||||
std::cerr << "PostedListWidget::deleteFeedItem() Nah";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
void PostedListWidget::openChat(const RsPeerId & /*peerId*/)
|
||||
{
|
||||
std::cerr << "PostedListWidget::openChat() Nah";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
void PostedListWidget::openComments(uint32_t /*feed_type*/, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title)
|
||||
{
|
||||
emit loadComment(groupId, msgId, title);
|
||||
}
|
||||
|
||||
void PostedListWidget::newPost()
|
||||
{
|
||||
if (mPostedId.isNull())
|
||||
return;
|
||||
|
||||
if (!IS_GROUP_SUBSCRIBED(mSubscribeFlags)) {
|
||||
return;
|
||||
}
|
||||
|
||||
PostedCreatePostDialog *cp = new PostedCreatePostDialog(mPostedQueue, rsPosted, mPostedId, this);
|
||||
cp->show();
|
||||
|
||||
/* window will destroy itself! */
|
||||
}
|
||||
|
||||
void PostedListWidget::showNext()
|
||||
{
|
||||
mPostIndex += mPostShow;
|
||||
if (mPostIndex > POSTED_MAX_INDEX)
|
||||
mPostIndex = POSTED_MAX_INDEX;
|
||||
applyRanking();
|
||||
updateShowText();
|
||||
}
|
||||
|
||||
void PostedListWidget::showPrev()
|
||||
{
|
||||
mPostIndex -= mPostShow;
|
||||
if (mPostIndex < 0)
|
||||
mPostIndex = 0;
|
||||
applyRanking();
|
||||
updateShowText();
|
||||
}
|
||||
|
||||
void PostedListWidget::updateShowText()
|
||||
{
|
||||
QString showText = tr("Showing");
|
||||
showText += " ";
|
||||
showText += QString::number(mPostIndex + 1);
|
||||
showText += "-";
|
||||
showText += QString::number(mPostIndex + mPostShow);
|
||||
ui->showLabel->setText(showText);
|
||||
}
|
||||
|
||||
void PostedListWidget::getRankings()
|
||||
{
|
||||
if (mPostedId.isNull())
|
||||
return;
|
||||
|
||||
std::cerr << "PostedListWidget::getRankings()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
int oldSortMethod = mSortMethod;
|
||||
|
||||
QObject* button = sender();
|
||||
if(button == ui->hotSortButton)
|
||||
{
|
||||
mSortMethod = RsPosted::HotRankType;
|
||||
}
|
||||
else if(button == ui->topSortButton)
|
||||
{
|
||||
mSortMethod = RsPosted::TopRankType;
|
||||
}
|
||||
else if(button == ui->newSortButton)
|
||||
{
|
||||
mSortMethod = RsPosted::NewRankType;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (oldSortMethod != mSortMethod)
|
||||
{
|
||||
/* Reset Counter */
|
||||
mPostIndex = 0;
|
||||
updateShowText();
|
||||
}
|
||||
|
||||
applyRanking();
|
||||
}
|
||||
|
||||
void PostedListWidget::submitVote(const RsGxsGrpMsgIdPair &msgId, bool up)
|
||||
{
|
||||
/* must grab AuthorId from Layout */
|
||||
RsGxsId authorId;
|
||||
switch (ui->idChooser->getChosenId(authorId)) {
|
||||
case GxsIdChooser::KnowId:
|
||||
case GxsIdChooser::UnKnowId:
|
||||
break;
|
||||
case GxsIdChooser::NoId:
|
||||
case GxsIdChooser::None:
|
||||
default:
|
||||
std::cerr << "PostedListWidget::createPost() ERROR GETTING AuthorId!, Vote Failed";
|
||||
std::cerr << std::endl;
|
||||
|
||||
QMessageBox::warning(this, tr("RetroShare"),tr("Please create or choose a Signing Id before Voting"), QMessageBox::Ok, QMessageBox::Ok);
|
||||
|
||||
return;
|
||||
}//switch (ui.idChooser->getChosenId(authorId))
|
||||
|
||||
RsGxsVote vote;
|
||||
|
||||
vote.mMeta.mGroupId = msgId.first;
|
||||
vote.mMeta.mThreadId = msgId.second;
|
||||
vote.mMeta.mParentId = msgId.second;
|
||||
vote.mMeta.mAuthorId = authorId;
|
||||
|
||||
if (up) {
|
||||
vote.mVoteType = GXS_VOTE_UP;
|
||||
} else { //if (up)
|
||||
vote.mVoteType = GXS_VOTE_DOWN;
|
||||
}//if (up)
|
||||
|
||||
std::cerr << "PostedListWidget::submitVote()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::cerr << "GroupId : " << vote.mMeta.mGroupId << std::endl;
|
||||
std::cerr << "ThreadId : " << vote.mMeta.mThreadId << std::endl;
|
||||
std::cerr << "ParentId : " << vote.mMeta.mParentId << std::endl;
|
||||
std::cerr << "AuthorId : " << vote.mMeta.mAuthorId << std::endl;
|
||||
|
||||
uint32_t token;
|
||||
rsPosted->createVote(token, vote);
|
||||
mPostedQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_VOTE);
|
||||
}
|
||||
|
||||
/*****************************************************************************************/
|
||||
|
||||
void PostedListWidget::updateDisplayedItems(const std::vector<RsGxsMessageId> &msgIds)
|
||||
{
|
||||
mPostedQueue->cancelActiveRequestTokens(TOKEN_USER_TYPE_POST_MOD);
|
||||
|
||||
if (mPostedId.isNull()) {
|
||||
mStateHelper->setActive(TOKEN_USER_TYPE_POST, false);
|
||||
mStateHelper->setLoading(TOKEN_USER_TYPE_POST, false);
|
||||
mStateHelper->clear(TOKEN_USER_TYPE_POST);
|
||||
emit groupChanged(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (msgIds.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mStateHelper->setLoading(TOKEN_USER_TYPE_POST, true);
|
||||
emit groupChanged(this);
|
||||
|
||||
RsTokReqOptions opts;
|
||||
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
||||
|
||||
GxsMsgReq msgs;
|
||||
msgs[mPostedId] = msgIds;
|
||||
|
||||
std::cerr << "PostedListWidget::updateDisplayedItems(" << mPostedId << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::vector<RsGxsMessageId>::const_iterator it;
|
||||
for(it = msgIds.begin(); it != msgIds.end(); it++)
|
||||
{
|
||||
std::cerr << "\t\tMsgId: " << *it;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
uint32_t token;
|
||||
mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgs, TOKEN_USER_TYPE_POST_MOD);
|
||||
}
|
||||
|
||||
void PostedListWidget::createNewGxsId()
|
||||
{
|
||||
IdEditDialog dlg(this);
|
||||
dlg.setupNewId(false);
|
||||
dlg.exec();
|
||||
ui->idChooser->setDefaultId(dlg.getLastIdName());
|
||||
}
|
||||
|
||||
void PostedListWidget::acknowledgeVoteMsg(const uint32_t &token)
|
||||
{
|
||||
RsGxsGrpMsgIdPair msgId;
|
||||
|
||||
rsPosted->acknowledgeVote(token, msgId);
|
||||
}
|
||||
|
||||
void PostedListWidget::loadVoteData(const uint32_t &/*token*/)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*********************** **** **** **** ***********************/
|
||||
/*********************** **** **** **** ***********************/
|
||||
|
||||
void PostedListWidget::requestGroupData()
|
||||
{
|
||||
#ifdef DEBUG_POSTED
|
||||
std::cerr << "PostedListWidget::requestGroupData()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
mSubscribeFlags = 0;
|
||||
|
||||
mPostedQueue->cancelActiveRequestTokens(TOKEN_USER_TYPE_TOPIC);
|
||||
|
||||
if (mPostedId.isNull()) {
|
||||
mStateHelper->setActive(TOKEN_USER_TYPE_TOPIC, false);
|
||||
mStateHelper->setLoading(TOKEN_USER_TYPE_TOPIC, false);
|
||||
mStateHelper->clear(TOKEN_USER_TYPE_TOPIC);
|
||||
|
||||
emit groupChanged(this);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
mStateHelper->setLoading(TOKEN_USER_TYPE_TOPIC, true);
|
||||
emit groupChanged(this);
|
||||
|
||||
std::list<RsGxsGroupId> groupIds;
|
||||
groupIds.push_back(mPostedId);
|
||||
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
|
||||
uint32_t token;
|
||||
mPostedQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, TOKEN_USER_TYPE_TOPIC);
|
||||
}
|
||||
|
||||
void PostedListWidget::loadGroupData(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "PostedListWidget::loadGroupData()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::vector<RsPostedGroup> groups;
|
||||
rsPosted->getGroupData(token, groups);
|
||||
|
||||
mStateHelper->setLoading(TOKEN_USER_TYPE_TOPIC, false);
|
||||
|
||||
if (groups.size() == 1)
|
||||
{
|
||||
insertPostedDetails(groups[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "PostedListWidget::loadGroupData() ERROR Invalid Number of Groups...";
|
||||
std::cerr << std::endl;
|
||||
|
||||
mStateHelper->setActive(TOKEN_USER_TYPE_TOPIC, false);
|
||||
mStateHelper->clear(TOKEN_USER_TYPE_TOPIC);
|
||||
}
|
||||
|
||||
emit groupChanged(this);
|
||||
}
|
||||
|
||||
void PostedListWidget::insertPostedDetails(const RsPostedGroup &group)
|
||||
{
|
||||
mStateHelper->setActive(TOKEN_USER_TYPE_TOPIC, true);
|
||||
|
||||
mSubscribeFlags = group.mMeta.mSubscribeFlags;
|
||||
|
||||
/* set name */
|
||||
mName = QString::fromUtf8(group.mMeta.mGroupName.c_str());
|
||||
|
||||
if (mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_PUBLISH)
|
||||
{
|
||||
mStateHelper->setWidgetEnabled(ui->submitPostButton, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
mStateHelper->setWidgetEnabled(ui->submitPostButton, false);
|
||||
}
|
||||
|
||||
// ui->subscribeToolButton->setSubscribed(IS_GROUP_SUBSCRIBED(mSubscribeFlags));
|
||||
}
|
||||
|
||||
/*********************** **** **** **** ***********************/
|
||||
/*********************** **** **** **** ***********************/
|
||||
/*********************** **** **** **** ***********************/
|
||||
/*********************** **** **** **** ***********************/
|
||||
|
||||
void PostedListWidget::requestPosts()
|
||||
{
|
||||
std::cerr << "PostedListWidget::loadCurrentForumThreads(" << mPostedId << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
clearPosts();
|
||||
|
||||
mPostedQueue->cancelActiveRequestTokens(TOKEN_USER_TYPE_POST);
|
||||
|
||||
if (mPostedId.isNull())
|
||||
{
|
||||
std::cerr << "PostedListWidget::loadCurrentForumThreads() Empty GroupId .. ignoring Req";
|
||||
std::cerr << std::endl;
|
||||
|
||||
mStateHelper->setActive(TOKEN_USER_TYPE_POST, false);
|
||||
mStateHelper->setLoading(TOKEN_USER_TYPE_POST, false);
|
||||
mStateHelper->clear(TOKEN_USER_TYPE_POST);
|
||||
emit groupChanged(this);
|
||||
return;
|
||||
}
|
||||
|
||||
mStateHelper->setLoading(TOKEN_USER_TYPE_POST, true);
|
||||
emit groupChanged(this);
|
||||
|
||||
/* initiate loading */
|
||||
RsTokReqOptions opts;
|
||||
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
||||
|
||||
std::list<RsGxsGroupId> grpIds;
|
||||
grpIds.push_back(mPostedId);
|
||||
|
||||
std::cerr << "PostedListWidget::requestGroupThreadData_InsertThreads(" << mPostedId << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
uint32_t token;
|
||||
mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, TOKEN_USER_TYPE_POST);
|
||||
}
|
||||
|
||||
void PostedListWidget::acknowledgePostMsg(const uint32_t &token)
|
||||
{
|
||||
RsGxsGrpMsgIdPair msgId;
|
||||
|
||||
// just acknowledge, don't load anything
|
||||
rsPosted->acknowledgeMsg(token, msgId);
|
||||
}
|
||||
|
||||
void PostedListWidget::loadPostData(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "PostedListWidget::loadGroupThreadData_InsertThreads()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
mStateHelper->setActive(TOKEN_USER_TYPE_POST, true);
|
||||
clearPosts();
|
||||
|
||||
std::vector<RsPostedPost> posts;
|
||||
rsPosted->getPostData(token, posts);
|
||||
std::vector<RsPostedPost>::iterator vit;
|
||||
|
||||
for(vit = posts.begin(); vit != posts.end(); vit++)
|
||||
{
|
||||
RsPostedPost& p = *vit;
|
||||
loadPost(p);
|
||||
}
|
||||
|
||||
applyRanking();
|
||||
|
||||
mStateHelper->setLoading(TOKEN_USER_TYPE_POST, false);
|
||||
emit groupChanged(this);
|
||||
}
|
||||
|
||||
void PostedListWidget::loadPost(const RsPostedPost &post)
|
||||
{
|
||||
PostedItem *item = new PostedItem(this, 0, post, true);
|
||||
connect(item, SIGNAL(vote(RsGxsGrpMsgIdPair,bool)), this, SLOT(submitVote(RsGxsGrpMsgIdPair,bool)));
|
||||
mPosts.insert(post.mMeta.mMsgId, item);
|
||||
//QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||
//alayout->addWidget(item);
|
||||
mPostList.push_back(item);
|
||||
}
|
||||
|
||||
static bool CmpPIHot(const PostedItem *a, const PostedItem *b)
|
||||
{
|
||||
const RsPostedPost &postA = a->getPost();
|
||||
const RsPostedPost &postB = b->getPost();
|
||||
|
||||
if (postA.mHotScore == postB.mHotScore)
|
||||
{
|
||||
return (postA.mNewScore > postB.mNewScore);
|
||||
}
|
||||
|
||||
return (postA.mHotScore > postB.mHotScore);
|
||||
}
|
||||
|
||||
static bool CmpPITop(const PostedItem *a, const PostedItem *b)
|
||||
{
|
||||
const RsPostedPost &postA = a->getPost();
|
||||
const RsPostedPost &postB = b->getPost();
|
||||
|
||||
if (postA.mTopScore == postB.mTopScore)
|
||||
{
|
||||
return (postA.mNewScore > postB.mNewScore);
|
||||
}
|
||||
|
||||
return (postA.mTopScore > postB.mTopScore);
|
||||
}
|
||||
|
||||
static bool CmpPINew(const PostedItem *a, const PostedItem *b)
|
||||
{
|
||||
return (a->getPost().mNewScore > b->getPost().mNewScore);
|
||||
}
|
||||
|
||||
void PostedListWidget::applyRanking()
|
||||
{
|
||||
/* uses current settings to sort posts, then add to layout */
|
||||
std::cerr << "PostedListWidget::applyRanking()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
shallowClearPosts();
|
||||
|
||||
/* sort */
|
||||
switch(mSortMethod)
|
||||
{
|
||||
default:
|
||||
case RsPosted::HotRankType:
|
||||
std::cerr << "PostedListWidget::applyRanking() HOT";
|
||||
std::cerr << std::endl;
|
||||
mPostList.sort(CmpPIHot);
|
||||
break;
|
||||
case RsPosted::NewRankType:
|
||||
std::cerr << "PostedListWidget::applyRanking() NEW";
|
||||
std::cerr << std::endl;
|
||||
mPostList.sort(CmpPINew);
|
||||
break;
|
||||
case RsPosted::TopRankType:
|
||||
std::cerr << "PostedListWidget::applyRanking() TOP";
|
||||
std::cerr << std::endl;
|
||||
mPostList.sort(CmpPITop);
|
||||
break;
|
||||
}
|
||||
mLastSortMethod = mSortMethod;
|
||||
|
||||
std::cerr << "PostedListWidget::applyRanking() Sorted mPostList";
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* go through list (skipping out-of-date items) to get */
|
||||
QLayout *alayout = ui->scrollAreaWidgetContents->layout();
|
||||
int counter = 0;
|
||||
time_t min_ts = 0;
|
||||
std::list<PostedItem *>::iterator it;
|
||||
for(it = mPostList.begin(); it != mPostList.end(); it++)
|
||||
{
|
||||
PostedItem *item = (*it);
|
||||
std::cerr << "PostedListWidget::applyRanking() Item: " << item;
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (item->getPost().mMeta.mPublishTs < min_ts)
|
||||
{
|
||||
std::cerr << "\t Skipping OLD";
|
||||
std::cerr << std::endl;
|
||||
item->hide();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (counter >= mPostIndex + mPostShow)
|
||||
{
|
||||
std::cerr << "\t END - Counter too high";
|
||||
std::cerr << std::endl;
|
||||
item->hide();
|
||||
}
|
||||
else if (counter >= mPostIndex)
|
||||
{
|
||||
std::cerr << "\t Adding to Layout";
|
||||
std::cerr << std::endl;
|
||||
/* add it in! */
|
||||
alayout->addWidget(item);
|
||||
item->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "\t Skipping to Low";
|
||||
std::cerr << std::endl;
|
||||
item->hide();
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
|
||||
std::cerr << "PostedListWidget::applyRanking() Loaded New Order";
|
||||
std::cerr << std::endl;
|
||||
|
||||
// trigger a redraw.
|
||||
ui->scrollAreaWidgetContents->update();
|
||||
}
|
||||
|
||||
void PostedListWidget::clearPosts()
|
||||
{
|
||||
std::cerr << "PostedListWidget::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 << "PostedListWidget::clearPosts() missing litem";
|
||||
std::cerr << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
PostedItem *item = dynamic_cast<PostedItem *>(litem->widget());
|
||||
if (item)
|
||||
{
|
||||
std::cerr << "PostedListWidget::clearPosts() item: " << item;
|
||||
std::cerr << std::endl;
|
||||
|
||||
postedItems.push_back(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "PostedListWidget::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;
|
||||
}
|
||||
|
||||
mPosts.clear();
|
||||
mPostList.clear();
|
||||
}
|
||||
|
||||
void PostedListWidget::shallowClearPosts()
|
||||
{
|
||||
std::cerr << "PostedListWidget::shallowClearPosts()" << 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 << "PostedListWidget::shallowClearPosts() missing litem";
|
||||
std::cerr << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
PostedItem *item = dynamic_cast<PostedItem *>(litem->widget());
|
||||
if (item)
|
||||
{
|
||||
std::cerr << "PostedListWidget::shallowClearPosts() item: " << item;
|
||||
std::cerr << std::endl;
|
||||
|
||||
postedItems.push_back(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "PostedListWidget::shallowClearPosts() 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);
|
||||
}
|
||||
}
|
||||
|
||||
void PostedListWidget::setAllMessagesRead(bool read)
|
||||
{
|
||||
// if (mPostedId.isNull() || !IS_GROUP_SUBSCRIBED(mSubscribeFlags)) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// QList<GxsChannelPostItem *>::iterator mit;
|
||||
// for (mit = mChannelPostItems.begin(); mit != mChannelPostItems.end(); ++mit) {
|
||||
// GxsChannelPostItem *item = *mit;
|
||||
// RsGxsGrpMsgIdPair msgPair = std::make_pair(item->groupId(), item->messageId());
|
||||
|
||||
// uint32_t token;
|
||||
// rsGxsChannels->setMessageReadStatus(token, msgPair, read);
|
||||
// }
|
||||
}
|
||||
|
||||
//void PostedListWidget::subscribeGroup(bool subscribe)
|
||||
//{
|
||||
// if (mChannelId.isNull()) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// uint32_t token;
|
||||
// rsGxsChannels->subscribeToGroup(token, mChannelId, subscribe);
|
||||
//// mChannelQueue->queueRequest(token, 0, RS_TOKREQ_ANSTYPE_ACK, TOKEN_TYPE_SUBSCRIBE_CHANGE);
|
||||
//}
|
||||
|
||||
void PostedListWidget::updateCurrentDisplayComplete(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "PostedListWidget::updateCurrentDisplayComplete()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::vector<RsPostedPost> posts;
|
||||
rsPosted->getPostData(token, posts);
|
||||
|
||||
mStateHelper->setActive(TOKEN_USER_TYPE_POST, true);
|
||||
|
||||
std::vector<RsPostedPost>::iterator vit;
|
||||
for(vit = posts.begin(); vit != posts.end(); vit++)
|
||||
{
|
||||
RsPostedPost& p = *vit;
|
||||
|
||||
// modify post content
|
||||
if(mPosts.find(p.mMeta.mMsgId) != mPosts.end())
|
||||
{
|
||||
std::cerr << "PostedListWidget::updateCurrentDisplayComplete() updating MsgId: " << p.mMeta.mMsgId;
|
||||
std::cerr << std::endl;
|
||||
|
||||
mPosts[p.mMeta.mMsgId]->setContent(p);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "PostedListWidget::updateCurrentDisplayComplete() loading New MsgId: " << p.mMeta.mMsgId;
|
||||
std::cerr << std::endl;
|
||||
/* insert new entry */
|
||||
loadPost(p);
|
||||
}
|
||||
}
|
||||
|
||||
time_t now = time(NULL);
|
||||
QMap<RsGxsMessageId, PostedItem*>::iterator pit;
|
||||
for(pit = mPosts.begin(); pit != mPosts.end(); pit++)
|
||||
{
|
||||
(*pit)->post().calculateScores(now);
|
||||
}
|
||||
|
||||
applyRanking();
|
||||
|
||||
mStateHelper->setLoading(TOKEN_USER_TYPE_POST, false);
|
||||
emit groupChanged(this);
|
||||
}
|
||||
|
||||
//void PostedListWidget::acknowledgeSubscribeChange(const uint32_t &token)
|
||||
//{
|
||||
// std::cerr << "PostedListWidget::acknowledgeSubscribeChange()";
|
||||
// std::cerr << std::endl;
|
||||
|
||||
// std::vector<RsPostedPost> posts;
|
||||
// RsGxsGroupId groupId;
|
||||
// rsPosted->acknowledgeGrp(token, groupId);
|
||||
|
||||
// insertGroups();
|
||||
//}
|
||||
|
||||
/*********************** **** **** **** ***********************/
|
||||
/*********************** **** **** **** ***********************/
|
||||
/*********************** **** **** **** ***********************/
|
||||
|
||||
void PostedListWidget::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
{
|
||||
std::cerr << "PostedListWidget::loadRequest() UserType: " << req.mUserType;
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (queue == mPostedQueue)
|
||||
{
|
||||
/* now switch on req */
|
||||
switch(req.mUserType)
|
||||
{
|
||||
case TOKEN_USER_TYPE_TOPIC:
|
||||
switch(req.mAnsType)
|
||||
{
|
||||
case RS_TOKREQ_ANSTYPE_DATA:
|
||||
loadGroupData(req.mToken);
|
||||
break;
|
||||
default:
|
||||
std::cerr << "Error, unexpected anstype:" << req.mAnsType << std::endl;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case TOKEN_USER_TYPE_POST:
|
||||
switch(req.mAnsType)
|
||||
{
|
||||
case RS_TOKREQ_ANSTYPE_ACK:
|
||||
acknowledgePostMsg(req.mToken);
|
||||
break;
|
||||
case RS_TOKREQ_ANSTYPE_DATA:
|
||||
loadPostData(req.mToken);
|
||||
break;
|
||||
default:
|
||||
std::cerr << "Error, unexpected anstype:" << req.mAnsType << std::endl;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case TOKEN_USER_TYPE_VOTE:
|
||||
switch(req.mAnsType)
|
||||
{
|
||||
case RS_TOKREQ_ANSTYPE_ACK:
|
||||
acknowledgeVoteMsg(req.mToken);
|
||||
break;
|
||||
default:
|
||||
std::cerr << "Error, unexpected anstype:" << req.mAnsType << std::endl;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case TOKEN_USER_TYPE_POST_MOD:
|
||||
switch(req.mAnsType)
|
||||
{
|
||||
case RS_TOKREQ_ANSTYPE_DATA:
|
||||
updateCurrentDisplayComplete(req.mToken);
|
||||
break;
|
||||
default:
|
||||
std::cerr << "Error, unexpected anstype:" << req.mAnsType << std::endl;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
// case TOKEN_USER_TYPE_POST_RANKINGS:
|
||||
// switch(req.mAnsType)
|
||||
// {
|
||||
// case RS_TOKREQ_ANSTYPE_DATA:
|
||||
// //loadRankings(req.mToken);
|
||||
// break;
|
||||
// default:
|
||||
// std::cerr << "Error, unexpected anstype:" << req.mAnsType << std::endl;
|
||||
// break;
|
||||
// }
|
||||
// case TOKEN_USER_TYPE_SUBSCRIBE_CHANGE:
|
||||
// acknowledgeSubscribeChange(req.mToken);
|
||||
// break;
|
||||
default:
|
||||
std::cerr << "PostedListWidget::loadRequest() ERROR: INVALID TYPE";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -21,82 +21,67 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MRK_POSTED_LIST_DIALOG_H
|
||||
#define MRK_POSTED_LIST_DIALOG_H
|
||||
#ifndef POSTED_LIST_WIDGET_H
|
||||
#define POSTED_LIST_WIDGET_H
|
||||
|
||||
#include "retroshare-gui/mainpage.h"
|
||||
#include "ui_PostedListDialog.h"
|
||||
#include <QMap>
|
||||
|
||||
#include <retroshare/rsposted.h>
|
||||
|
||||
#include "util/TokenQueue.h"
|
||||
#include "gui/gxs/RsGxsUpdateBroadcastPage.h"
|
||||
|
||||
#include "gui/gxs/GxsCommentContainer.h"
|
||||
#include "gui/gxs/GxsMessageFrameWidget.h"
|
||||
#include "gui/feeds/FeedHolder.h"
|
||||
#include "util/TokenQueue.h"
|
||||
|
||||
#define IMAGE_POSTED ":/images/posted_32.png"
|
||||
|
||||
class RsPostedGroup;
|
||||
class RsPostedPost;
|
||||
class PostedItem;
|
||||
class UIStateHelper;
|
||||
|
||||
/*********************** **** **** **** ***********************/
|
||||
/** Request / Response of Data ********************************/
|
||||
/*********************** **** **** **** ***********************/
|
||||
namespace Ui {
|
||||
class PostedListWidget;
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
class PostedListDialog : public RsGxsUpdateBroadcastPage, public FeedHolder, public TokenResponse, public GxsServiceDialog
|
||||
class PostedListWidget : public GxsMessageFrameWidget, public FeedHolder, public TokenResponse
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PostedListDialog(QWidget *parent = 0);
|
||||
|
||||
virtual QIcon iconPixmap() const { return QIcon(IMAGE_POSTED) ; } //MainPage
|
||||
virtual QString pageName() const { return tr("Posted Links") ; } //MainPage
|
||||
virtual QString helpText() const { return ""; } //MainPage
|
||||
|
||||
PostedListWidget(const RsGxsGroupId &postedId, QWidget *parent = 0);
|
||||
~PostedListWidget();
|
||||
|
||||
// Overloaded from FeedHolder.
|
||||
/* GxsMessageFrameWidget */
|
||||
virtual RsGxsGroupId groupId() { return mPostedId; }
|
||||
virtual void setGroupId(const RsGxsGroupId &postedId);
|
||||
virtual QString groupName(bool withUnreadCount);
|
||||
virtual QIcon groupIcon();
|
||||
virtual void setAllMessagesRead(bool read);
|
||||
|
||||
/* FeedHolder */
|
||||
virtual QScrollArea *getScrollArea();
|
||||
virtual void deleteFeedItem(QWidget *item, uint32_t type);
|
||||
virtual void openChat(const RsPeerId& peerId);
|
||||
virtual void openChat(const RsPeerId& peerId);
|
||||
virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title);
|
||||
|
||||
/* NEW GXS FNS */
|
||||
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
||||
protected:
|
||||
virtual void updateDisplay(bool complete);
|
||||
|
||||
private slots:
|
||||
void groupListCustomPopupMenu(QPoint point);
|
||||
void changedTopic(const QString &id);
|
||||
|
||||
void newTopic();
|
||||
void showTopic();
|
||||
void editTopic();
|
||||
|
||||
void createNewGxsId();
|
||||
|
||||
void showGroupDetails();
|
||||
void newPost();
|
||||
|
||||
void submitVote(const RsGxsGrpMsgIdPair& msgId, bool up);
|
||||
|
||||
void getRankings();
|
||||
|
||||
void subscribeTopic();
|
||||
void unsubscribeTopic();
|
||||
// void subscribeTopic();
|
||||
// void unsubscribeTopic();
|
||||
|
||||
void showNext();
|
||||
void showPrev();
|
||||
|
||||
void todo();
|
||||
|
||||
protected:
|
||||
virtual void updateDisplay(bool complete);
|
||||
|
||||
private:
|
||||
void processSettings(bool load);
|
||||
void updateShowText();
|
||||
|
||||
void clearPosts();
|
||||
@ -108,24 +93,17 @@ private:
|
||||
|
||||
void loadPost(const RsPostedPost &post);
|
||||
|
||||
void insertGroups();
|
||||
void requestGroupSummary();
|
||||
void acknowledgeGroup(const uint32_t &token);
|
||||
void loadGroupSummary(const uint32_t &token);
|
||||
|
||||
void requestGroupSummary_CurrentForum(const RsGxsGroupId &forumId);
|
||||
void loadGroupSummary_CurrentForum(const uint32_t &token);
|
||||
void requestGroupData();
|
||||
void loadGroupData(const uint32_t &token);
|
||||
void insertPostedDetails(const RsPostedGroup &group);
|
||||
|
||||
// subscribe/unsubscribe ack.
|
||||
void acknowledgeSubscribeChange(const uint32_t &token);
|
||||
// void acknowledgeSubscribeChange(const uint32_t &token);
|
||||
|
||||
// posts
|
||||
void acknowledgePostMsg(const uint32_t &token);
|
||||
void loadPostData(const uint32_t &token);
|
||||
void insertThreads();
|
||||
void loadCurrentTopicThreads(const RsGxsGroupId &forumId);
|
||||
void requestGroupThreadData_InsertThreads(const RsGxsGroupId &forumId);
|
||||
void loadGroupThreadData_InsertThreads(const uint32_t &token);
|
||||
void requestPosts();
|
||||
|
||||
// votes
|
||||
void acknowledgeVoteMsg(const uint32_t& token);
|
||||
@ -140,27 +118,16 @@ private:
|
||||
void updateDisplayedItems(const std::vector<RsGxsMessageId>& msgIds);
|
||||
void updateCurrentDisplayComplete(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);
|
||||
|
||||
|
||||
private:
|
||||
QTreeWidgetItem *yourTopics;
|
||||
QTreeWidgetItem *subscribedTopics;
|
||||
QTreeWidgetItem *popularTopics;
|
||||
QTreeWidgetItem *otherTopics;
|
||||
|
||||
int mSortMethod;
|
||||
int mLastSortMethod;
|
||||
int mPostIndex;
|
||||
int mPostShow;
|
||||
|
||||
bool mThreadLoading;
|
||||
RsGxsGroupId mCurrTopicId;
|
||||
int mSubscribeFlags;
|
||||
RsGxsGroupId mPostedId;
|
||||
QString mName;
|
||||
|
||||
QMap<RsGxsGroupId, RsPostedGroup> mGroups;
|
||||
QMap<RsGxsMessageId, PostedItem*> mPosts;
|
||||
std::list<PostedItem *> mPostList;
|
||||
|
||||
@ -168,9 +135,10 @@ private:
|
||||
|
||||
//CommentHolder* mCommentHolder;
|
||||
|
||||
UIStateHelper *mStateHelper;
|
||||
|
||||
/* UI - from Designer */
|
||||
Ui::PostedListDialog ui;
|
||||
Ui::PostedListWidget *ui;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
332
retroshare-gui/src/gui/Posted/PostedListWidget.ui
Normal file
332
retroshare-gui/src/gui/Posted/PostedListWidget.ui
Normal file
@ -0,0 +1,332 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PostedListWidget</class>
|
||||
<widget class="QWidget" name="PostedListWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>756</width>
|
||||
<height>428</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="sortGroup">
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="hotSortButton">
|
||||
<property name="text">
|
||||
<string>Hot</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="Posted_images.qrc">
|
||||
<normaloff>:/images/hot_24.png</normaloff>:/images/hot_24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoExclusive">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="newSortButton">
|
||||
<property name="text">
|
||||
<string>New</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="Posted_images.qrc">
|
||||
<normaloff>:/images/new_24.png</normaloff>:/images/new_24.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoExclusive">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="topSortButton">
|
||||
<property name="text">
|
||||
<string>Top</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/vote_up.png</normaloff>:/images/vote_up.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="autoExclusive">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</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="periodComboBox">
|
||||
<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>
|
||||
<item>
|
||||
<widget class="GxsIdChooser" name="idChooser"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_NewId">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Create new Identity</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New ID</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/identity/identity_create_32.png</normaloff>:/images/identity/identity_create_32.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="submitPostButton">
|
||||
<property name="text">
|
||||
<string>Submit a new Post</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="Posted_images.qrc">
|
||||
<normaloff>:/images/posted_24.png</normaloff>:/images/posted_24.png</iconset>
|
||||
</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="showLabel">
|
||||
<property name="text">
|
||||
<string>Showing 1-100</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="prevButton">
|
||||
<property name="text">
|
||||
<string>Prev</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="nextButton">
|
||||
<property name="text">
|
||||
<string>Next</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<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>754</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>GxsIdChooser</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>gui/gxs/GxsIdChooser.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
<include location="Posted_images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
94
retroshare-gui/src/gui/Posted/PostedUserNotify.cpp
Normal file
94
retroshare-gui/src/gui/Posted/PostedUserNotify.cpp
Normal file
@ -0,0 +1,94 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2014 RetroShare Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#include "PostedUserNotify.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "gui/MainWindow.h"
|
||||
|
||||
PostedUserNotify::PostedUserNotify(RsGxsIfaceHelper *ifaceImpl, QObject *parent) :
|
||||
GxsUserNotify(ifaceImpl, parent)
|
||||
{
|
||||
}
|
||||
|
||||
bool PostedUserNotify::hasSetting(QString &name)
|
||||
{
|
||||
name = tr("Posted");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PostedUserNotify::notifyEnabled()
|
||||
{
|
||||
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_POSTED);
|
||||
}
|
||||
|
||||
bool PostedUserNotify::notifyCombined()
|
||||
{
|
||||
return (Settings->getTrayNotifyFlags() & TRAYNOTIFY_POSTED_COMBINED);
|
||||
}
|
||||
|
||||
bool PostedUserNotify::notifyBlink()
|
||||
{
|
||||
return (Settings->getTrayNotifyBlinkFlags() & TRAYNOTIFY_BLINK_POSTED);
|
||||
}
|
||||
|
||||
void PostedUserNotify::setNotifyEnabled(bool enabled, bool combined, bool blink)
|
||||
{
|
||||
uint notifyFlags = Settings->getTrayNotifyFlags();
|
||||
uint blinkFlags = Settings->getTrayNotifyBlinkFlags();
|
||||
|
||||
if (enabled) {
|
||||
notifyFlags |= TRAYNOTIFY_POSTED;
|
||||
} else {
|
||||
notifyFlags &= ~TRAYNOTIFY_POSTED;
|
||||
}
|
||||
|
||||
if (combined) {
|
||||
notifyFlags |= TRAYNOTIFY_POSTED_COMBINED;
|
||||
} else {
|
||||
notifyFlags &= ~TRAYNOTIFY_POSTED_COMBINED;
|
||||
}
|
||||
|
||||
if (blink) {
|
||||
blinkFlags |= TRAYNOTIFY_BLINK_POSTED;
|
||||
} else {
|
||||
blinkFlags &= ~TRAYNOTIFY_BLINK_POSTED;
|
||||
}
|
||||
|
||||
Settings->setTrayNotifyFlags(notifyFlags);
|
||||
Settings->setTrayNotifyBlinkFlags(blinkFlags);
|
||||
}
|
||||
|
||||
QIcon PostedUserNotify::getIcon()
|
||||
{
|
||||
return QIcon(":/images/wikibook_32.png");
|
||||
}
|
||||
|
||||
QIcon PostedUserNotify::getMainIcon(bool hasNew)
|
||||
{
|
||||
//TODO: add new icon
|
||||
return hasNew ? QIcon(":/images/wikibook_32.png") : QIcon(":/images/wikibook_32.png");
|
||||
}
|
||||
|
||||
void PostedUserNotify::iconClicked()
|
||||
{
|
||||
MainWindow::showWindow(MainWindow::Posted);
|
||||
}
|
46
retroshare-gui/src/gui/Posted/PostedUserNotify.h
Normal file
46
retroshare-gui/src/gui/Posted/PostedUserNotify.h
Normal file
@ -0,0 +1,46 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2014 RetroShare Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#ifndef POSTEDUSERNOTIFY_H
|
||||
#define POSTEDUSERNOTIFY_H
|
||||
|
||||
#include "gui/gxs/GxsUserNotify.h"
|
||||
|
||||
class PostedUserNotify : public GxsUserNotify
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PostedUserNotify(RsGxsIfaceHelper *ifaceImpl, QObject *parent = 0);
|
||||
|
||||
virtual bool hasSetting(QString &name);
|
||||
virtual bool notifyEnabled();
|
||||
virtual bool notifyCombined();
|
||||
virtual bool notifyBlink();
|
||||
virtual void setNotifyEnabled(bool enabled, bool combined, bool blink);
|
||||
|
||||
private:
|
||||
virtual QIcon getIcon();
|
||||
virtual QIcon getMainIcon(bool hasNew);
|
||||
virtual void iconClicked();
|
||||
};
|
||||
|
||||
#endif // POSTEDUSERNOTIFY_H
|
@ -261,15 +261,19 @@ void GxsGroupFrameDialog::groupTreeCustomPopupMenu(QPoint point)
|
||||
action = contextMnu.addAction(QIcon(IMAGE_EDIT), tr("Edit Details"), this, SLOT(editGroupDetails()));
|
||||
action->setEnabled (!mGroupId.isNull() && isAdmin);
|
||||
|
||||
action = contextMnu.addAction(QIcon(IMAGE_SHARE), tr("Share"), this, SLOT(shareKey()));
|
||||
action->setEnabled(!mGroupId.isNull() && isAdmin);
|
||||
if (shareKeyType()) {
|
||||
action = contextMnu.addAction(QIcon(IMAGE_SHARE), tr("Share"), this, SLOT(shareKey()));
|
||||
action->setEnabled(!mGroupId.isNull() && isAdmin);
|
||||
}
|
||||
|
||||
if (!mGroupId.isNull() && isPublisher && !isAdmin) {
|
||||
contextMnu.addAction(QIcon(":/images/settings16.png"), tr("Restore Publish Rights" ), this, SLOT(restoreGroupKeys()));
|
||||
}
|
||||
|
||||
action = contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyGroupLink()));
|
||||
action->setEnabled(!mGroupId.isNull());
|
||||
if (getLinkType() != RetroShareLink::TYPE_UNKNOWN) {
|
||||
action = contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyGroupLink()));
|
||||
action->setEnabled(!mGroupId.isNull());
|
||||
}
|
||||
|
||||
contextMnu.addSeparator();
|
||||
|
||||
|
@ -125,8 +125,8 @@ void GxsChannelPostsWidget::updateDisplay(bool complete)
|
||||
{
|
||||
if (complete) {
|
||||
/* Fill complete */
|
||||
requestGroupData(mChannelId);
|
||||
requestPosts(mChannelId);
|
||||
requestGroupData();
|
||||
requestPosts();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ void GxsChannelPostsWidget::updateDisplay(bool complete)
|
||||
if (!mChannelId.isNull() && std::find(grpIds.begin(), grpIds.end(), mChannelId) != grpIds.end()) {
|
||||
updateGroup = true;
|
||||
/* Do we need to fill all posts? */
|
||||
requestPosts(mChannelId);
|
||||
requestPosts();
|
||||
} else {
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgs;
|
||||
getAllMsgIds(msgs);
|
||||
@ -153,13 +153,13 @@ void GxsChannelPostsWidget::updateDisplay(bool complete)
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::const_iterator mit = msgs.find(mChannelId);
|
||||
if(mit != msgs.end())
|
||||
{
|
||||
requestRelatedPosts(mChannelId, mit->second);
|
||||
requestRelatedPosts(mit->second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (updateGroup) {
|
||||
requestGroupData(mChannelId);
|
||||
requestGroupData();
|
||||
}
|
||||
}
|
||||
|
||||
@ -247,6 +247,10 @@ void GxsChannelPostsWidget::createMsg()
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IS_GROUP_SUBSCRIBED(mSubscribeFlags)) {
|
||||
return;
|
||||
}
|
||||
|
||||
CreateGxsChannelMsg *msgDialog = new CreateGxsChannelMsg(mChannelId);
|
||||
msgDialog->show();
|
||||
|
||||
@ -619,7 +623,7 @@ void GxsChannelPostsWidget::clearPosts()
|
||||
/** Request / Response of Data ********************************/
|
||||
/*********************** **** **** **** ***********************/
|
||||
|
||||
void GxsChannelPostsWidget::requestGroupData(const RsGxsGroupId &grpId)
|
||||
void GxsChannelPostsWidget::requestGroupData()
|
||||
{
|
||||
#ifdef DEBUG_CHANNEL
|
||||
std::cerr << "GxsChannelPostsWidget::requestGroupData()";
|
||||
@ -630,7 +634,7 @@ void GxsChannelPostsWidget::requestGroupData(const RsGxsGroupId &grpId)
|
||||
|
||||
mChannelQueue->cancelActiveRequestTokens(TOKEN_TYPE_GROUP_DATA);
|
||||
|
||||
if (grpId.isNull()) {
|
||||
if (mChannelId.isNull()) {
|
||||
mStateHelper->setActive(TOKEN_TYPE_GROUP_DATA, false);
|
||||
mStateHelper->setLoading(TOKEN_TYPE_GROUP_DATA, false);
|
||||
mStateHelper->clear(TOKEN_TYPE_GROUP_DATA);
|
||||
@ -647,7 +651,7 @@ void GxsChannelPostsWidget::requestGroupData(const RsGxsGroupId &grpId)
|
||||
emit groupChanged(this);
|
||||
|
||||
std::list<RsGxsGroupId> groupIds;
|
||||
groupIds.push_back(grpId);
|
||||
groupIds.push_back(mChannelId);
|
||||
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
@ -684,7 +688,7 @@ void GxsChannelPostsWidget::loadGroupData(const uint32_t &token)
|
||||
emit groupChanged(this);
|
||||
}
|
||||
|
||||
void GxsChannelPostsWidget::requestPosts(const RsGxsGroupId &grpId)
|
||||
void GxsChannelPostsWidget::requestPosts()
|
||||
{
|
||||
#ifdef DEBUG_CHANNEL
|
||||
std::cerr << "GxsChannelPostsWidget::requestPosts()";
|
||||
@ -696,7 +700,7 @@ void GxsChannelPostsWidget::requestPosts(const RsGxsGroupId &grpId)
|
||||
|
||||
mChannelQueue->cancelActiveRequestTokens(TOKEN_TYPE_POSTS);
|
||||
|
||||
if (grpId.isNull()) {
|
||||
if (mChannelId.isNull()) {
|
||||
mStateHelper->setActive(TOKEN_TYPE_POSTS, false);
|
||||
mStateHelper->setLoading(TOKEN_TYPE_POSTS, false);
|
||||
mStateHelper->clear(TOKEN_TYPE_POSTS);
|
||||
@ -708,7 +712,7 @@ void GxsChannelPostsWidget::requestPosts(const RsGxsGroupId &grpId)
|
||||
emit groupChanged(this);
|
||||
|
||||
std::list<RsGxsGroupId> groupIds;
|
||||
groupIds.push_back(grpId);
|
||||
groupIds.push_back(mChannelId);
|
||||
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
@ -735,7 +739,7 @@ void GxsChannelPostsWidget::loadPosts(const uint32_t &token)
|
||||
emit groupChanged(this);
|
||||
}
|
||||
|
||||
void GxsChannelPostsWidget::requestRelatedPosts(const RsGxsGroupId &grpId, const std::vector<RsGxsMessageId> &msgIds)
|
||||
void GxsChannelPostsWidget::requestRelatedPosts(const std::vector<RsGxsMessageId> &msgIds)
|
||||
{
|
||||
#ifdef DEBUG_CHANNEL
|
||||
std::cerr << "GxsChannelPostsWidget::requestRelatedPosts()";
|
||||
@ -744,7 +748,7 @@ void GxsChannelPostsWidget::requestRelatedPosts(const RsGxsGroupId &grpId, const
|
||||
|
||||
mChannelQueue->cancelActiveRequestTokens(TOKEN_TYPE_RELATEDPOSTS);
|
||||
|
||||
if (grpId.isNull()) {
|
||||
if (mChannelId.isNull()) {
|
||||
mStateHelper->setActive(TOKEN_TYPE_POSTS, false);
|
||||
mStateHelper->setLoading(TOKEN_TYPE_POSTS, false);
|
||||
mStateHelper->clear(TOKEN_TYPE_POSTS);
|
||||
@ -766,7 +770,7 @@ void GxsChannelPostsWidget::requestRelatedPosts(const RsGxsGroupId &grpId, const
|
||||
uint32_t token;
|
||||
std::vector<RsGxsGrpMsgIdPair> relatedMsgIds;
|
||||
for (std::vector<RsGxsMessageId>::const_iterator msgIt = msgIds.begin(); msgIt != msgIds.end(); ++msgIt) {
|
||||
relatedMsgIds.push_back(RsGxsGrpMsgIdPair(grpId, *msgIt));
|
||||
relatedMsgIds.push_back(RsGxsGrpMsgIdPair(mChannelId, *msgIt));
|
||||
}
|
||||
mChannelQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, relatedMsgIds, TOKEN_TYPE_RELATEDPOSTS);
|
||||
}
|
||||
@ -800,7 +804,7 @@ void GxsChannelPostsWidget::acknowledgeMessageUpdate(const uint32_t &token)
|
||||
rsGxsChannels->acknowledgeMsg(token, msgId);
|
||||
if (msgId.first == mChannelId)
|
||||
{
|
||||
requestPosts(mChannelId);
|
||||
requestPosts();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,13 +86,13 @@ private:
|
||||
void clearPosts();
|
||||
|
||||
/* NEW GXS FNS */
|
||||
void requestGroupData(const RsGxsGroupId &grpId);
|
||||
void requestGroupData();
|
||||
void loadGroupData(const uint32_t &token);
|
||||
|
||||
void requestPosts(const RsGxsGroupId &grpId);
|
||||
void requestPosts();
|
||||
void loadPosts(const uint32_t &token);
|
||||
|
||||
void requestRelatedPosts(const RsGxsGroupId &grpId, const std::vector<RsGxsMessageId> &msgIds);
|
||||
void requestRelatedPosts(const std::vector<RsGxsMessageId> &msgIds);
|
||||
void loadRelatedPosts(const uint32_t &token);
|
||||
|
||||
void insertChannelDetails(const RsGxsChannelGroup &group);
|
||||
|
@ -912,7 +912,7 @@ void GxsForumThreadWidget::insertThreads()
|
||||
}
|
||||
|
||||
// Get Current Forum Info... then complete insertForumThreads().
|
||||
requestGroup_CurrentForum(mForumId);
|
||||
requestGroup_CurrentForum();
|
||||
}
|
||||
|
||||
void GxsForumThreadWidget::insertForumThreads(const RsGxsForumGroup &group)
|
||||
@ -1693,7 +1693,7 @@ bool GxsForumThreadWidget::filterItem(QTreeWidgetItem *item, const QString &text
|
||||
/** Request / Response of Data ********************************/
|
||||
/*********************** **** **** **** ***********************/
|
||||
|
||||
void GxsForumThreadWidget::requestGroup_CurrentForum(const RsGxsGroupId &forumId)
|
||||
void GxsForumThreadWidget::requestGroup_CurrentForum()
|
||||
{
|
||||
ui->progressBar->reset();
|
||||
mStateHelper->setLoading(TOKEN_TYPE_CURRENTFORUM, true);
|
||||
@ -1706,9 +1706,9 @@ void GxsForumThreadWidget::requestGroup_CurrentForum(const RsGxsGroupId &forumId
|
||||
mThreadQueue->cancelActiveRequestTokens(TOKEN_TYPE_CURRENTFORUM);
|
||||
|
||||
std::list<RsGxsGroupId> grpIds;
|
||||
grpIds.push_back(forumId);
|
||||
grpIds.push_back(mForumId);
|
||||
|
||||
std::cerr << "GxsForumsDialog::requestGroup_CurrentForum(" << forumId << ")";
|
||||
std::cerr << "GxsForumsDialog::requestGroup_CurrentForum(" << mForumId << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
uint32_t token;
|
||||
|
@ -142,7 +142,7 @@ private:
|
||||
unsigned int mUnreadCount;
|
||||
unsigned int mNewCount;
|
||||
|
||||
void requestGroup_CurrentForum(const RsGxsGroupId &forumId);
|
||||
void requestGroup_CurrentForum();
|
||||
void loadGroup_CurrentForum(const uint32_t &token);
|
||||
|
||||
void requestMsgData_InsertPost(const RsGxsGrpMsgIdPair &msgId);
|
||||
|
@ -463,7 +463,7 @@ void RshareSettings::setNotifyFlags(uint flags)
|
||||
|
||||
uint RshareSettings::getTrayNotifyFlags()
|
||||
{
|
||||
return value(SETTING_TRAYNOTIFY_FLAGS, TRAYNOTIFY_PRIVATECHAT | TRAYNOTIFY_MESSAGES | TRAYNOTIFY_CHANNELS | TRAYNOTIFY_FORUMS ).toUInt();
|
||||
return value(SETTING_TRAYNOTIFY_FLAGS, TRAYNOTIFY_PRIVATECHAT | TRAYNOTIFY_MESSAGES | TRAYNOTIFY_CHANNELS | TRAYNOTIFY_FORUMS | TRAYNOTIFY_POSTED ).toUInt();
|
||||
}
|
||||
|
||||
void RshareSettings::setTrayNotifyFlags(uint flags)
|
||||
|
@ -44,11 +44,15 @@
|
||||
#define TRAYNOTIFY_FORUMS_COMBINED 0x00000100
|
||||
#define TRAYNOTIFY_TRANSFERS_COMBINED 0x00000200
|
||||
|
||||
#define TRAYNOTIFY_POSTED 0x00000400
|
||||
#define TRAYNOTIFY_POSTED_COMBINED 0x00000800
|
||||
|
||||
#define TRAYNOTIFY_BLINK_PRIVATECHAT 0x00000001
|
||||
#define TRAYNOTIFY_BLINK_MESSAGES 0x00000002
|
||||
#define TRAYNOTIFY_BLINK_CHANNELS 0x00000004
|
||||
#define TRAYNOTIFY_BLINK_FORUMS 0x00000008
|
||||
#define TRAYNOTIFY_BLINK_TRANSFERS 0x00000010
|
||||
#define TRAYNOTIFY_BLINK_POSTED 0x00000020
|
||||
|
||||
#define RS_CHATLOBBY_BLINK 0x00000001
|
||||
|
||||
|
@ -1176,16 +1176,17 @@ gxschannels {
|
||||
posted {
|
||||
|
||||
HEADERS += gui/Posted/PostedDialog.h \
|
||||
gui/Posted/PostedListDialog.h \
|
||||
gui/Posted/PostedListWidget.h \
|
||||
gui/Posted/PostedItem.h \
|
||||
gui/Posted/PostedGroupDialog.h \
|
||||
gui/Posted/PostedCreatePostDialog.h \
|
||||
gui/Posted/PostedUserTypes.h
|
||||
gui/Posted/PostedUserTypes.h \
|
||||
gui/Posted/PostedUserNotify.h
|
||||
|
||||
#gui/Posted/PostedCreateCommentDialog.h \
|
||||
#gui/Posted/PostedComments.h \
|
||||
|
||||
FORMS += gui/Posted/PostedListDialog.ui \
|
||||
FORMS += gui/Posted/PostedListWidget.ui \
|
||||
gui/Posted/PostedItem.ui \
|
||||
gui/Posted/PostedCreatePostDialog.ui \
|
||||
|
||||
@ -1193,10 +1194,12 @@ posted {
|
||||
#gui/Posted/PostedComments.ui \
|
||||
#gui/Posted/PostedCreateCommentDialog.ui
|
||||
|
||||
SOURCES += gui/Posted/PostedListDialog.cpp \
|
||||
SOURCES += gui/Posted/PostedDialog.cpp \
|
||||
gui/Posted/PostedListWidget.cpp \
|
||||
gui/Posted/PostedItem.cpp \
|
||||
gui/Posted/PostedGroupDialog.cpp \
|
||||
gui/Posted/PostedCreatePostDialog.cpp \
|
||||
gui/Posted/PostedUserNotify.cpp
|
||||
|
||||
#gui/Posted/PostedDialog.cpp \
|
||||
#gui/Posted/PostedComments.cpp \
|
||||
|
Loading…
x
Reference in New Issue
Block a user