Added New Services to GUI.

- Added GxsChannels 
 - Added New Common Comments GUI elements.
 - Moved Posted over to use Comments.
 
Lots done, but lots to do!



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6212 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2013-03-11 20:53:15 +00:00
parent a05f04900c
commit da4c1e0f7f
38 changed files with 5725 additions and 550 deletions

View file

@ -0,0 +1,91 @@
/*
* 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 "gui/gxs/GxsCommentContainer.h"
#include "gui/gxs/GxsCommentDialog.h"
#include <iostream>
#include <sstream>
#include <QTimer>
#include <QMessageBox>
/******
* #define PHOTO_DEBUG 1
*****/
/****************************************************************
* Posted Dialog
*
*/
GxsCommentContainer::GxsCommentContainer(QWidget *parent)
: MainPage(parent)
{
ui.setupUi(this);
}
void GxsCommentContainer::setup()
{
mServiceDialog = createServiceDialog();
QString name = getServiceName();
QString list(name);
QWidget *widget = dynamic_cast<QWidget *>(mServiceDialog);
ui.tabWidget->addTab(widget, name);
}
void GxsCommentContainer::commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId)
{
QString comments(tr("Comments"));
GxsCommentDialog *commentDialog = new GxsCommentDialog(this, getTokenService(), getCommentService());
GxsCommentHeader *commentHeader = createHeaderWidget();
commentDialog->setCommentHeader(commentHeader);
commentDialog->commentLoad(grpId, msgId);
//commentHeader->commentLoad(grpId, msgId);
ui.tabWidget->addTab(commentDialog, comments);
}

View file

@ -0,0 +1,97 @@
/*
* Retroshare Comment Container 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".
*
*/
#ifndef MRK_COMMENT_CONTAINER_DIALOG_H
#define MRK_COMMENT_CONTAINER_DIALOG_H
#include "retroshare-gui/mainpage.h"
#include "ui_GxsCommentContainer.h"
#include <retroshare/rsgxscommon.h>
#include <retroshare/rstokenservice.h>
#include <map>
class GxsCommentHeader
{
public:
/*!
* This should be used for loading comments of a message on a main comment viewing page
* @param msgId the message id for which comments will be requested
*/
virtual void commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId) = 0;
};
class GxsServiceDialog;
class GxsCommentContainer : public MainPage
{
Q_OBJECT
public:
GxsCommentContainer(QWidget *parent = 0);
void setup();
void commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId);
virtual GxsServiceDialog *createServiceDialog() = 0;
virtual QString getServiceName() = 0;
virtual RsTokenService *getTokenService() = 0;
virtual RsGxsCommentService *getCommentService() = 0;
virtual GxsCommentHeader *createHeaderWidget() = 0;
private:
GxsServiceDialog *mServiceDialog;
/* UI - from Designer */
Ui::GxsCommentContainer ui;
};
class GxsServiceDialog
{
public:
GxsServiceDialog(GxsCommentContainer *container)
:mContainer(container) { return; }
virtual ~GxsServiceDialog() { return; }
void commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId)
{
mContainer->commentLoad(grpId, msgId);
}
private:
GxsCommentContainer *mContainer;
};
#endif

View file

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GxsCommentContainer</class>
<widget class="QWidget" name="GxsCommentContainer">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>726</width>
<height>557</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>1</number>
</property>
<item>
<widget class="QFrame" name="titleBarFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap>:/images/posted_24.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Comment Container</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>573</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>-1</number>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="Posted_images.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -0,0 +1,90 @@
/*
* Retroshare Comment 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 "gui/gxs/GxsCommentDialog.h"
//#include "gxs/GxsCreateComment.h"
//#include <retroshare/rsposted.h>
#include <iostream>
#include <sstream>
#include <QTimer>
#include <QMessageBox>
#include <QDateTime>
/** Constructor */
GxsCommentDialog::GxsCommentDialog(QWidget *parent, RsTokenService *token_service, RsGxsCommentService *comment_service)
:QWidget(parent)
{
ui.setupUi(this);
//ui.postFrame->setVisible(false);
ui.treeWidget->setup(token_service, comment_service);
}
void GxsCommentDialog::commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId)
{
std::cerr << "GxsCommentDialog::commentLoad(" << grpId << ", " << msgId << ")";
std::cerr << std::endl;
mGrpId = grpId;
mMsgId = msgId;
RsGxsGrpMsgIdPair threadId;
threadId.first = grpId;
threadId.second = msgId;
ui.treeWidget->requestComments(threadId);
}
void GxsCommentDialog::setCommentHeader(GxsCommentHeader *header)
{
#if 0
ui.postFrame->setVisible(true);
QDateTime qtime;
qtime.setTime_t(mCurrentPost.mMeta.mPublishTs);
QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm");
ui.dateLabel->setText(timestamp);
ui.fromLabel->setText(QString::fromUtf8(mCurrentPost.mMeta.mAuthorId.c_str()));
ui.titleLabel->setText("<a href=" + QString::fromStdString(mCurrentPost.mLink) +
"><span style=\" text-decoration: underline; color:#0000ff;\">" +
QString::fromStdString(mCurrentPost.mMeta.mMsgName) + "</span></a>");
ui.siteLabel->setText("<a href=" + QString::fromStdString(mCurrentPost.mLink) +
"><span style=\" text-decoration: underline; color:#0000ff;\">" +
QString::fromStdString(mCurrentPost.mLink) + "</span></a>");
ui.scoreLabel->setText(QString("0"));
ui.notesBrowser->setPlainText(QString::fromStdString(mCurrentPost.mNotes));
#endif
}

View file

@ -0,0 +1,51 @@
/*
* Retroshare Comment 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".
*
*/
#ifndef MRK_GXS_COMMENT_DIALOG_H
#define MRK_GXS_COMMENT_DIALOG_H
#include "ui_GxsCommentDialog.h"
#include "gui/gxs/GxsCommentContainer.h"
class GxsCommentDialog: public QWidget
{
Q_OBJECT
public:
GxsCommentDialog(QWidget *parent, RsTokenService *token_service, RsGxsCommentService *comment_service);
void setCommentHeader(GxsCommentHeader *header);
void commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId);
private:
RsGxsGroupId mGrpId;
RsGxsMessageId mMsgId;
/* UI - from Designer */
Ui::GxsCommentDialog ui;
};
#endif

View file

@ -0,0 +1,367 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GxsCommentDialog</class>
<widget class="QWidget" name="GxsCommentDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>632</width>
<height>398</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QFrame" name="postFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(203, 203, 203);</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,1">
<item>
<widget class="QLabel" name="scoreLabel">
<property name="font">
<font>
<pointsize>20</pointsize>
</font>
</property>
<property name="text">
<string>1</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QToolButton" name="voteUpButton">
<property name="text">
<string>/\</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>score</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="voteDownButton">
<property name="text">
<string>\/</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="titleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Title this is a very very very very loooooooooooooooonnnnnnnnnnnnnnnnng title dont you think? yes it is and should wrap around I hope</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QHBoxLayout" name="_4">
<item>
<widget class="QLabel" name="dateBoldLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Date</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="dateLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string notr="true">You eyes only</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="_3">
<item>
<widget class="QLabel" name="fromBoldLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>From</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="fromLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string notr="true">Signed by</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="_5">
<item>
<widget class="QLabel" name="fromBoldLabel_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Site</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="siteLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string notr="true">Signed by</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="notesBrowser">
<property name="styleSheet">
<string notr="true">background-color: rgb(203, 203, 203);</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QGroupBox" name="sortGroup">
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<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="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="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="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="QPushButton" name="pushButton_5">
<property name="text">
<string>Refresh</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="GxsCommentTreeWidget" name="treeWidget">
<column>
<property name="text">
<string>Comment</string>
</property>
</column>
<column>
<property name="text">
<string>Author</string>
</property>
</column>
<column>
<property name="text">
<string>Date</string>
</property>
</column>
<column>
<property name="text">
<string>Points</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>GxsCommentTreeWidget</class>
<extends>QTreeWidget</extends>
<header>gui/gxs/GxsCommentTreeWidget.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View file

@ -24,7 +24,7 @@
#include <QMenu>
#include "gui/gxs/GxsCommentTreeWidget.h"
#include "gui/Posted/PostedCreateCommentDialog.h"
#include "gui/gxs/GxsCreateCommentDialog.h"
#include <iostream>
@ -37,14 +37,12 @@
#define GXSCOMMENTS_LOADTHREAD 1
// Temporarily make this specific.
#include "retroshare/rsposted.h"
/* Images for context menu icons */
#define IMAGE_MESSAGE ":/images/folder-draft.png"
GxsCommentTreeWidget::GxsCommentTreeWidget(QWidget *parent)
:QTreeWidget(parent), mRsService(NULL), mTokenQueue(NULL)
:QTreeWidget(parent), mRsTokenService(NULL), mCommentService(NULL), mTokenQueue(NULL)
{
// QTreeWidget* widget = this;
@ -88,7 +86,7 @@ void GxsCommentTreeWidget::customPopUpMenu(const QPoint& point)
void GxsCommentTreeWidget::makeComment()
{
PostedCreateCommentDialog pcc(mTokenQueue, mThreadId, mThreadId.second, this);
GxsCreateCommentDialog pcc(mTokenQueue, mCommentService, mThreadId, mThreadId.second, this);
pcc.exec();
}
@ -97,14 +95,15 @@ void GxsCommentTreeWidget::replyToComment()
RsGxsGrpMsgIdPair msgId;
msgId.first = mThreadId.first;
msgId.second = mCurrentMsgId;
PostedCreateCommentDialog pcc(mTokenQueue, msgId, mThreadId.second, this);
GxsCreateCommentDialog pcc(mTokenQueue, mCommentService, msgId, mThreadId.second, this);
pcc.exec();
}
void GxsCommentTreeWidget::setup(RsTokenService *service)
void GxsCommentTreeWidget::setup(RsTokenService *token_service, RsGxsCommentService *comment_service)
{
mRsService = service;
mTokenQueue = new TokenQueue(service, this);
mRsTokenService = token_service;
mCommentService = comment_service;
mTokenQueue = new TokenQueue(token_service, this);
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customPopUpMenu(QPoint)));
connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(setCurrentMsgId(QTreeWidgetItem*, QTreeWidgetItem*)));
@ -259,7 +258,7 @@ void GxsCommentTreeWidget::loadThread(const uint32_t &token)
void GxsCommentTreeWidget::acknowledgeComment(const uint32_t &token)
{
RsGxsGrpMsgIdPair msgId;
rsPosted->acknowledgeMsg(token, msgId);
mCommentService->acknowledgeComment(token, msgId);
// simply reload data
service_requestComments(mThreadId);
@ -271,15 +270,14 @@ void GxsCommentTreeWidget::service_loadThread(const uint32_t &token)
std::cerr << "GxsCommentTreeWidget::service_loadThread() ERROR must be overloaded!";
std::cerr << std::endl;
PostedRelatedCommentResult commentResult;
rsPosted->getRelatedComment(token, commentResult);
std::vector<RsGxsComment> comments;
mCommentService->getRelatedComments(token, comments);
std::vector<RsPostedComment>& commentV = commentResult[mThreadId];
std::vector<RsPostedComment>::iterator vit = commentV.begin();
std::vector<RsGxsComment>::iterator vit;
for(; vit != commentV.end(); vit++)
for(vit = comments.begin(); vit != comments.end(); vit++)
{
RsPostedComment& comment = *vit;
RsGxsComment &comment = *vit;
/* convert to a QTreeWidgetItem */
std::cerr << "GxsCommentTreeWidget::service_loadThread() Got Comment: " << comment.mMeta.mMsgId;
std::cerr << std::endl;

View file

@ -25,6 +25,7 @@
#include <QTreeWidget>
#include "util/TokenQueue.h"
#include <retroshare/rsgxscommon.h>
class GxsCommentTreeWidget : public QTreeWidget, public TokenResponse
{
@ -32,7 +33,7 @@ class GxsCommentTreeWidget : public QTreeWidget, public TokenResponse
public:
GxsCommentTreeWidget(QWidget *parent = 0);
void setup(RsTokenService *service);
void setup(RsTokenService *token_service, RsGxsCommentService *comment_service);
void requestComments(const RsGxsGrpMsgIdPair& threadId);
void getCurrentMsgId(RsGxsMessageId& parentId);
@ -73,7 +74,8 @@ protected:
std::multimap<std::string, QTreeWidgetItem *> mPendingInsertMap;
TokenQueue *mTokenQueue;
RsTokenService *mRsService;
RsTokenService *mRsTokenService;
RsGxsCommentService *mCommentService;
};

View file

@ -0,0 +1,32 @@
#include "GxsCreateCommentDialog.h"
#include "ui_GxsCreateCommentDialog.h"
GxsCreateCommentDialog::GxsCreateCommentDialog(TokenQueue *tokQ, RsGxsCommentService *service,
const RsGxsGrpMsgIdPair &parentId, const RsGxsMessageId& threadId, QWidget *parent) :
QDialog(parent),
ui(new Ui::GxsCreateCommentDialog), mTokenQueue(tokQ), mCommentService(service), mParentId(parentId), mThreadId(threadId)
{
ui->setupUi(this);
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(createComment()));
}
void GxsCreateCommentDialog::createComment()
{
RsGxsComment comment;
comment.mComment = ui->commentTextEdit->document()->toPlainText().toStdString();
comment.mMeta.mParentId = mParentId.second;
comment.mMeta.mGroupId = mParentId.first;
comment.mMeta.mThreadId = mThreadId;
uint32_t token;
mCommentService->createComment(token, comment);
mTokenQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
close();
}
GxsCreateCommentDialog::~GxsCreateCommentDialog()
{
delete ui;
}

View file

@ -0,0 +1,34 @@
#ifndef _MRK_GXS_CREATE_COMMENT_DIALOG_H
#define _MRK_GXS_CREATE_COMMENT_DIALOG_H
#include <QDialog>
#include "retroshare/rsgxscommon.h"
#include "util/TokenQueue.h"
namespace Ui {
class GxsCreateCommentDialog;
}
class GxsCreateCommentDialog : public QDialog
{
Q_OBJECT
public:
explicit GxsCreateCommentDialog(TokenQueue* tokQ, RsGxsCommentService *service,
const RsGxsGrpMsgIdPair& parentId, const RsGxsMessageId& threadId, QWidget *parent = 0);
~GxsCreateCommentDialog();
private slots:
void createComment();
private:
Ui::GxsCreateCommentDialog *ui;
TokenQueue *mTokenQueue;
RsGxsCommentService *mCommentService;
RsGxsGrpMsgIdPair mParentId;
RsGxsMessageId mThreadId;
};
#endif // _MRK_GXS_CREATE_COMMENT_DIALOG_H

View file

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GxsCreateCommentDialog</class>
<widget class="QDialog" name="GxsCreateCommentDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>372</width>
<height>145</height>
</rect>
</property>
<property name="windowTitle">
<string>Make Comment</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;Comment&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="commentTextEdit"/>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>PostedCreateCommentDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>PostedCreateCommentDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>