* Addition of NewsFeed, ChannelFeed and BlogFeed.

* Added new GUI NewsFeed elements to display information (gui/feeds/*)
 * modifications to RS interfaces to support NewsFeeds.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@617 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2008-06-20 12:43:23 +00:00
parent 9f024eaee7
commit 07451c5336
43 changed files with 6550 additions and 1303 deletions

View File

@ -151,7 +151,19 @@ HEADERS += rshare.h \
gui/channels/mySubscriptionsDialog.h \
gui/elastic/graphwidget.h \
gui/elastic/edge.h \
gui/elastic/node.h
gui/elastic/node.h \
gui/NewsFeed.h \
gui/ChannelFeed.h \
gui/GeneralMsgDialog.h \
gui/feeds/FeedHolder.h \
gui/feeds/ForumNewItem.h \
gui/feeds/ForumMsgItem.h \
gui/feeds/PeerItem.h \
gui/feeds/ChanGroupItem.h \
gui/feeds/ChanMenuItem.h \
gui/feeds/ChanMsgItem.h \
gui/feeds/BlogMsgItem.h \
gui/feeds/SubFileItem.h \
FORMS += gui/ChatDialog.ui \
@ -214,7 +226,18 @@ FORMS += gui/ChatDialog.ui \
gui/channels/ChannelBrowserDialog.ui \
gui/channels/ChannelStatsDialog.ui \
gui/channels/MyChannelsDialog.ui \
gui/channels/MySubscriptionsDialog.ui
gui/channels/MySubscriptionsDialog.ui \
gui/NewsFeed.ui \
gui/ChannelFeed.ui \
gui/GeneralMsgDialog.ui \
gui/feeds/ForumNewItem.ui \
gui/feeds/ForumMsgItem.ui \
gui/feeds/PeerItem.ui \
gui/feeds/ChanGroupItem.ui \
gui/feeds/ChanMenuItem.ui \
gui/feeds/ChanMsgItem.ui \
gui/feeds/BlogMsgItem.ui \
gui/feeds/SubFileItem.ui \
SOURCES += main.cpp \
rshare.cpp \
@ -315,7 +338,18 @@ SOURCES += main.cpp \
gui/channels/mySubscriptionsDialog.cpp \
gui/elastic/graphwidget.cpp \
gui/elastic/edge.cpp \
gui/elastic/node.cpp
gui/elastic/node.cpp \
gui/NewsFeed.cpp \
gui/ChannelFeed.cpp \
gui/GeneralMsgDialog.cpp \
gui/feeds/ForumNewItem.cpp \
gui/feeds/ForumMsgItem.cpp \
gui/feeds/PeerItem.cpp \
gui/feeds/ChanGroupItem.cpp \
gui/feeds/ChanMenuItem.cpp \
gui/feeds/ChanMsgItem.cpp \
gui/feeds/BlogMsgItem.cpp \
gui/feeds/SubFileItem.cpp \
RESOURCES += gui/images.qrc lang/lang.qrc games/qcheckers/qcheckers.qrc apps/smplayer/icons.qrc
TRANSLATIONS += \

View File

@ -48,6 +48,8 @@
#include "channels/channelsDialog.h"
#include "BlogDialog.h"
#include "CalDialog.h"
#include "NewsFeed.h"
#include "ChannelFeed.h"
/* for smplayer */
#include "smplayer.h"
@ -74,6 +76,7 @@
#define IMAGE_CLOSE ":/images/close_normal.png"
#define IMAGE_SMPLAYER ":/images/smplayer_icon32.png"
#define IMAGE_CALENDAR ":/images/calendar.png"
#define IMAGE_NEWSFEED ":/images/konsole.png"
/* Keys for UI Preferences */
@ -101,32 +104,41 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags)
// ui.stackPages->add(linksDialog = new LinksDialog(ui.stackPages),
// createPageAction(QIcon(IMAGE_TRANSFERS), tr("Links Cloud"), grp));
ChannelsDialog *channelsDialog = NULL;
ui.stackPages->add(channelsDialog = new ChannelsDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_CHANNELS), tr("Channels"), grp));
GamesDialog *gamesDialog = NULL;
ui.stackPages->add(gamesDialog = new GamesDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_GAMES), tr("Games Launcher"), grp));
// ChannelsDialog *channelsDialog = NULL;
// ui.stackPages->add(channelsDialog = new ChannelsDialog(ui.stackPages),
// createPageAction(QIcon(IMAGE_CHANNELS), tr("Channels"), grp));
NewsFeed *newsFeed = NULL;
ui.stackPages->add(newsFeed = new NewsFeed(ui.stackPages),
createPageAction(QIcon(IMAGE_NEWSFEED), tr("News Feed"), grp));
ForumsDialog *forumsDialog = NULL;
ui.stackPages->add(forumsDialog = new ForumsDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_NETWORK), tr("Forums"), grp));
PhotoDialog *photoDialog = NULL;
ui.stackPages->add(photoDialog = new PhotoDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_PHOTO), tr("Photo View"), grp));
ChannelFeed *channelFeed = NULL;
ui.stackPages->add(channelFeed = new ChannelFeed(ui.stackPages),
createPageAction(QIcon(IMAGE_CHANNELS), tr("Channel Feed"), grp));
BlogDialog *blogDialog = NULL;
ui.stackPages->add(blogDialog = new BlogDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_NETWORK), tr("Blog Feed"), grp));
GamesDialog *gamesDialog = NULL;
ui.stackPages->add(gamesDialog = new GamesDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_GAMES), tr("Games Launcher"), grp));
PhotoDialog *photoDialog = NULL;
ui.stackPages->add(photoDialog = new PhotoDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_PHOTO), tr("Photo View"), grp));
CalDialog *calDialog = NULL;
ui.stackPages->add(calDialog = new CalDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_CALENDAR), tr("Shared Calendars"), grp));
//ui.stackPages->add(groupsDialog = new GroupsDialog(ui.stackPages),
// createPageAction(QIcon(), tr("Groups"), grp));

View File

@ -25,162 +25,57 @@
#include "rsiface/rsQblog.h"
#include "rsiface/rspeers.h" //to retrieve peer/usrId info
#include "profile/ProfileView.h"
#include "gui/feeds/BlogMsgItem.h"
/** Constructor */
BlogDialog::BlogDialog(QWidget *parent)
: MainPage (parent)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
connect(sendBtn, SIGNAL(clicked()), this, SLOT(sendBlog()));
//connect(statusBtn, SIGNAL(clicked()), this, SLOT(setStatus()));
connect(boldBtn, SIGNAL(clicked()), this, SLOT(setFont()));
connect(underlineBtn, SIGNAL(clicked()), this, SLOT(setFont()));
connect(italicBtn, SIGNAL(clicked()), this, SLOT(setFont()));
connect(refreshBtn, SIGNAL(clicked()), this, SLOT(update()));
connect(userList, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( peerCustomPopupMenu( QPoint ) ) );
/* Current Font */
mCurrentFont = QFont("Comic Sans MS", 8);
setupUi(this);
/* Font for username and timestamp */
mUsrFont = QFont("Comic Sans MS", 8);
}
void BlogDialog::peerCustomPopupMenu( QPoint point )
{
/*
*/
connect(postButton, SIGNAL(clicked()), this, SLOT(postBlog()));
QMenu contextMnu( this );
QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier );
/* mLayout -> to add widgets to */
mLayout = new QVBoxLayout;
QAction *profileAct = new QAction( tr( "Show Profile" ), this );
QAction *onlyoneAct = new QAction( tr( "Show Only This Blog" ), this );
QAction *allAct = new QAction( tr( "Show All Blogs" ), this );
QWidget *middleWidget = new QWidget();
middleWidget->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
middleWidget->setLayout(mLayout);
connect( profileAct , SIGNAL( triggered() ), this, SLOT( showuserprofile() ) );
connect( onlyoneAct , SIGNAL( triggered() ), this, SLOT( showoneblog() ) );
connect( allAct , SIGNAL( triggered() ), this, SLOT( showallblogs() ) );
QScrollArea *scrollArea = new QScrollArea;
scrollArea->setBackgroundRole(QPalette::Dark);
scrollArea->setWidget(middleWidget);
scrollArea->setWidgetResizable(true);
scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
contextMnu.clear();
contextMnu.addAction( profileAct );
contextMnu.addAction( onlyoneAct );
contextMnu.addAction( allAct );
contextMnu.exec( mevent->globalPos() );
}
void BlogDialog::showuserprofile()
{
showprofile("");
}
void BlogDialog::showprofile(std::string id)
{
static ProfileView *oneProfile = new ProfileView(NULL);
oneProfile -> setPeerId(id);
oneProfile -> show();
}
void BlogDialog::showoneblog()
{
return;
}
void BlogDialog::showallblogs()
{
return;
}
void BlogDialog::sendBlog()
{
QString blogMsg = lineEdit->toPlainText();
if(blogMsg == "")
{
QMessageBox::information(this, tr("No message entered"),
tr("Please enter a message."),QMessageBox::Ok,
QMessageBox::Ok);
}
else
{
/* note: timing will be handled by core */
std::string blog = blogMsg.toStdString();
rsQblog->sendBlog(blog);
}
lineEdit->clear();//Clear lineEdit
lineEdit->setFocus(); //setFocus on lineEdit
}
void BlogDialog::setFont()
{
mCurrentFont.setUnderline(underlineBtn->isChecked());
mCurrentFont.setItalic(italicBtn->isChecked());
mCurrentFont.setBold(boldBtn->isChecked());
lineEdit->setFont(mCurrentFont);
lineEdit->setFocus();
}
/*
* this will also send to core, to blog "updated"
*/
void BlogDialog::setStatus()
{
QString statusMsg = lineEdit->toPlainText();
QVBoxLayout *layout2 = new QVBoxLayout;
layout2->addWidget(scrollArea);
std::list<std::string> UsrList;
frame->setLayout(layout2);
/* test to see if load dummy data worked ! */
addDummyData();
updateBlogsStatic();
QTimer *timer = new QTimer(this);
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateBlogs()));
timer->start(15631);
if(statusMsg == "")
{
QMessageBox::information(this, tr("No message"),
tr("Please enter a message."),QMessageBox::Ok,
QMessageBox::Ok);
}
else
{
rsQblog->setStatus("whatsup");
}
/* Clear lineEdit */
lineEdit->clear();
/* setFocus on lineEdit **/
lineEdit->setFocus();
}
void BlogDialog::addUser(const std::string &usr)
{
QTreeWidgetItem *NewUser = new QTreeWidgetItem(userList);
NewUser->setText(0, tr(usr.c_str()));
//TODO can add status as subtree to each user (use rsQblog.getStatus(usr) )
}
void BlogDialog::clear(void)
{
blogText->clear();
}
void BlogDialog::update(void)
{
updateUserList();
updateBlogs();
}
void BlogDialog::updateBlogs(void)
{
}
void BlogDialog::updateBlogsStatic(void)
{
#if 0
rsQblog->getFilterSwitch();
std::map<std::string, std::string> UsrStatus;
@ -249,55 +144,53 @@ void BlogDialog::updateBlogs(void)
}
}
#endif
}
void BlogDialog::updateUserList(void)
void BlogDialog::addDummyData()
{
/* retrieve usr names and populate usr list bar */
std::list<std::string> usrList;
/* get existing list ... */
std::list<std::string> filterList;
BlogMsgItem *bm1 = new BlogMsgItem(this, 0, "peerId", "msgId", true);
BlogMsgItem *bm2 = new BlogMsgItem(this, 0, "peerId", "msgId", true);
BlogMsgItem *bm3 = new BlogMsgItem(this, 0, "peerId", "msgId", true);
BlogMsgItem *bm4 = new BlogMsgItem(this, 0, "peerId", "msgId", true);
BlogMsgItem *bm5 = new BlogMsgItem(this, 0, "peerId", "msgId", true);
std::list<std::string>::iterator it;
if ((!rsPeers) || (!rsQblog))
{
/* not ready yet! */
return;
}
rsPeers->getFriendList(usrList);
usrList.push_back(rsPeers->getOwnId()); // add your id
//rsQblog->getFilterList(filterList);
userList->clear();
/* print usr name and their blogs to screen */
for(it = usrList.begin(); it !=usrList.end(); it++)
{
QTreeWidgetItem *item = new QTreeWidgetItem(userList);
bool active = false;
if (filterList.end() != std::find(filterList.begin(), filterList.end(), *it))
active = true;
item->setText(0, QString::fromStdString(rsPeers->getPeerName(*it))); // add usr to Qwidget tree
item->setText(1, QString::fromStdString(*it)); // add usr id.
if (active)
{
item -> setCheckState(0, Qt::Checked);
}
else
{
item -> setCheckState(0, Qt::Unchecked);
}
}
mLayout->addWidget(bm1);
mLayout->addWidget(bm2);
mLayout->addWidget(bm3);
mLayout->addWidget(bm4);
mLayout->addWidget(bm5);
}
/* FeedHolder Functions (for FeedItem functionality) */
void BlogDialog::deleteFeedItem(QWidget *item, uint32_t type)
{
std::cerr << "BlogDialog::deleteFeedItem()";
std::cerr << std::endl;
}
void BlogDialog::openChat(std::string peerId)
{
std::cerr << "BlogDialog::openChat()";
std::cerr << std::endl;
}
void BlogDialog::postBlog()
{
openMsg(FEEDHOLDER_MSG_BLOG, "", "");
}
void BlogDialog::openMsg(uint32_t type, std::string grpId, std::string inReplyTo)
{
std::cerr << "BlogDialog::openMsg()";
std::cerr << std::endl;
}

View File

@ -25,53 +25,36 @@
#include "mainpage.h"
#include "ui_BlogDialog.h"
class BlogDialog : public MainPage , private Ui::BlogDialog
#include "gui/feeds/FeedHolder.h"
class BlogMsgItem;
class BlogDialog : public MainPage, public FeedHolder, private Ui::BlogDialog
{
Q_OBJECT
public:
/** Default Constructor */
BlogDialog(QWidget *parent = 0);
/** Default Destructor */
/** Default Constructor */
BlogDialog(QWidget *parent = 0);
/** Qt Designer generated object */
//Ui::BlogDialog ui;
public slots:
void sendBlog();
void setFont();
void setStatus();
/// populates blog service with current information from core
void update();
/* FeedHolder Functions (for FeedItem functionality) */
virtual void deleteFeedItem(QWidget *item, uint32_t type);
virtual void openChat(std::string peerId);
virtual void openMsg(uint32_t type, std::string grpId, std::string inReplyTo);
void updateBlogsStatic();
void showprofile(std::string id);
void updateUserList();
void updateBlogs();
private slots:
/** context popup menus */
void peerCustomPopupMenu( QPoint point );
/* peer ContextMenu Actions */
void showuserprofile();
void showoneblog();
void showallblogs();
void updateBlogs();
void postBlog();
private:
void addDummyData();
/// to add usr to usr list: utility function for update
void addUser(const std::string& usr);
/// remove everything from usrlist and blogText box
void clear();
/* Current Font */
QFont mCurrentFont;
/* Font to be used for username (bold) */
QFont mUsrFont;
QLayout *mLayout;
std::map<std::string, BlogMsgItem *> mBlogMsgItems;
};

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,140 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* 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 <QtGui>
#include "ChannelFeed.h"
#include "gui/feeds/ChanGroupItem.h"
#include "gui/feeds/ChanMenuItem.h"
#include "gui/feeds/ChanMsgItem.h"
/** Constructor */
ChannelFeed::ChannelFeed(QWidget *parent)
: MainPage (parent)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
/* add dynamic widgets in */
/* add layout */
/* add form */
QVBoxLayout *layout = new QVBoxLayout;
ChanGroupItem *cg1 = new ChanGroupItem("Own Channels");
ChanGroupItem *cg2 = new ChanGroupItem("Subscribed Channels");
ChanGroupItem *cg3 = new ChanGroupItem("Popular Channels");
ChanGroupItem *cg4 = new ChanGroupItem("Other Channels");
ChanMenuItem *cm1 = new ChanMenuItem("Channel with long name");
ChanMenuItem *cm2 = new ChanMenuItem("Channel with very very very very long name");
ChanMenuItem *cm3 = new ChanMenuItem("Channel with long name");
ChanMenuItem *cm4 = new ChanMenuItem("Retroshare Releases");
ChanMenuItem *cm5 = new ChanMenuItem("Popular Channel");
layout->addWidget(cg1);
layout->addWidget(cm1);
layout->addWidget(cg2);
layout->addWidget(cm2);
layout->addWidget(cm3);
layout->addWidget(cm4);
layout->addWidget(cg3);
layout->addWidget(cm5);
layout->addWidget(cg4);
QWidget *middleWidget = new QWidget();
//middleWidget->setSizePolicy( QSizePolicy::Policy::Maximum, QSizePolicy::Policy::Minimum);
middleWidget->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
middleWidget->setLayout(layout);
QScrollArea *scrollArea = new QScrollArea;
scrollArea->setBackgroundRole(QPalette::Dark);
scrollArea->setWidget(middleWidget);
scrollArea->setWidgetResizable(true);
scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
QVBoxLayout *layout2 = new QVBoxLayout;
layout2->addWidget(scrollArea);
chanFrame->setLayout(layout2);
/***** SECOND HALF *****/
QVBoxLayout *msgLayout = new QVBoxLayout;
ChanMsgItem *ni1 = new ChanMsgItem(NULL, 0, "JEZ", "MSGID:47654765476", true);
ChanMsgItem *ni2 = new ChanMsgItem(NULL, 0, "JEZ", "MSGID:47654765476", true);
ChanMsgItem *ni3 = new ChanMsgItem(NULL, 0, "JEZ", "MSGID:47654765476", true);
ChanMsgItem *ni4 = new ChanMsgItem(NULL, 0, "JEZ", "MSGID:47654765476", true);
ChanMsgItem *ni5 = new ChanMsgItem(NULL, 0, "JEZ", "MSGID:47654765476", true);
ChanMsgItem *ni6 = new ChanMsgItem(NULL, 0, "JEZ", "MSGID:47654765476", true);
ChanMsgItem *ni7 = new ChanMsgItem(NULL, 0, "JEZ", "MSGID:47654765476", true);
ChanMsgItem *ni8 = new ChanMsgItem(NULL, 0, "JEZ", "MSGID:47654765476", true);
msgLayout->addWidget(ni1);
msgLayout->addWidget(ni2);
msgLayout->addWidget(ni3);
msgLayout->addWidget(ni4);
msgLayout->addWidget(ni5);
msgLayout->addWidget(ni6);
msgLayout->addWidget(ni7);
msgLayout->addWidget(ni8);
QWidget *middleWidget2 = new QWidget();
middleWidget2->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
middleWidget2->setLayout(msgLayout);
QScrollArea *scrollArea2 = new QScrollArea;
scrollArea2->setBackgroundRole(QPalette::Dark);
scrollArea2->setWidget(middleWidget2);
scrollArea2->setWidgetResizable(true);
scrollArea2->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
QVBoxLayout *layout3 = new QVBoxLayout;
layout3->addWidget(scrollArea2);
msgFrame->setLayout(layout3);
}
void ChannelFeed::deleteFeedItem(QWidget *item, uint32_t type)
{
return;
}
void ChannelFeed::openChat(std::string peerId)
{
return;
}
void ChannelFeed::openMsg(uint32_t type, std::string grpId, std::string inReplyTo)
{
return;
}

View File

@ -0,0 +1,53 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* 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 _CHANNEL_FEED_DIALOG_H
#define _CHANNEL_FEED_DIALOG_H
#include "mainpage.h"
#include "ui_ChannelFeed.h"
#include "gui/feeds/FeedHolder.h"
class ChannelFeed : public MainPage, public FeedHolder, private Ui::ChannelFeed
{
Q_OBJECT
public:
/** Default Constructor */
ChannelFeed(QWidget *parent = 0);
/** Default Destructor */
virtual void deleteFeedItem(QWidget *item, uint32_t type);
virtual void openChat(std::string peerId);
virtual void openMsg(uint32_t type, std::string grpId, std::string inReplyTo);
private:
/* lists of feedItems */
//std::list<ChanMsgItem *> mChanMsgItems;
};
#endif

View File

@ -0,0 +1,202 @@
<ui version="4.0" >
<class>ChannelFeed</class>
<widget class="QWidget" name="ChannelFeed" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>607</width>
<height>674</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<layout class="QVBoxLayout" >
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QPushButton" name="chanButton" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Create Channel</string>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/network32.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>151</width>
<height>28</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="iconLabel" >
<property name="text" >
<string/>
</property>
<property name="pixmap" >
<pixmap resource="images.qrc" >:/images/contacts24.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="nameLabel" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Channel Name</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="postButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Post To Channel</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/mail_send.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="subscribeButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Subscribe To Channel</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/directoryadd_24x24_shadow.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="unsubscribeButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Unsubcribe To Channel</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/directoryremove_24x24_shadow.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QSplitter" name="splitter" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<widget class="QFrame" name="chanFrame" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
</widget>
<widget class="QFrame" name="msgFrame" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
</widget>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="images.qrc" />
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,57 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* 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 <QtGui>
#include "GeneralMsgDialog.h"
#include "gui/feeds/FeedHolder.h"
#include <iostream>
/** Constructor */
GeneralMsgDialog::GeneralMsgDialog(QWidget *parent)
: QDialog (parent)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
}
void GeneralMsgDialog::cancelMsg()
{
return;
}
void GeneralMsgDialog::sendMsg()
{
return;
}
void GeneralMsgDialog::addDestination(uint32_t type, std::string grpId, std::string inReplyTo)
{
std::cerr << "GeneralMsgDialog::addDestination()";
std::cerr << std::endl;
return;
}

View File

@ -0,0 +1,48 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* 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 _GENERAL_MSG_DIALOG_H
#define _GENERAL_MSG_DIALOG_H
#include "ui_GeneralMsgDialog.h"
class GeneralMsgDialog : public QDialog, private Ui::GeneralMsgDialog
{
Q_OBJECT
public:
/** Default Constructor */
GeneralMsgDialog(QWidget *parent = 0);
/** Default Destructor */
virtual void addDestination(uint32_t type, std::string grpId, std::string inReplyTo);
virtual void cancelMsg();
virtual void sendMsg();
private:
};
#endif

View File

@ -0,0 +1,315 @@
<ui version="4.0" >
<class>GeneralMsgDialog</class>
<widget class="QDialog" name="GeneralMsgDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>455</width>
<height>516</height>
</rect>
</property>
<property name="windowTitle" >
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" >
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QComboBox" name="typeComboBox" >
<item>
<property name="text" >
<string>Friend</string>
</property>
</item>
<item>
<property name="text" >
<string>Channel</string>
</property>
</item>
<item>
<property name="text" >
<string>Forum</string>
</property>
</item>
<item>
<property name="text" >
<string>Blog</string>
</property>
</item>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="destIdComboBox" />
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="addButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Add Message Destination</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/loadcert16.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="destFrame" >
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" >
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="label_2" >
<property name="text" >
<string/>
</property>
<property name="pixmap" >
<pixmap resource="images.qrc" >:/images/contacts24.png</pixmap>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Message Destination</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>271</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="fileFrame" >
<property name="minimumSize" >
<size>
<width>16</width>
<height>60</height>
</size>
</property>
<property name="acceptDrops" >
<bool>true</bool>
</property>
<property name="toolTip" >
<string>Drag and Drop Files from Search Results</string>
</property>
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" >
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="label_3" >
<property name="text" >
<string/>
</property>
<property name="pixmap" >
<pixmap resource="images.qrc" >:/images/attachment.png</pixmap>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_4" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Attachments</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>271</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="label_5" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Subject :</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="subjectEdit" />
</item>
</layout>
</item>
<item>
<widget class="QTextEdit" name="msgEdit" />
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="images.qrc" />
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>GeneralMsgDialog</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>GeneralMsgDialog</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>

View File

@ -95,7 +95,6 @@
* #define RS_RELEASE_VERSION 1
****/
#define RS_RELEASE_VERSION 1
/** Constructor */
MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)

View File

@ -0,0 +1,340 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* 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 <QtGui>
#include "NewsFeed.h"
#include <iostream>
#include "rsiface/rsnotify.h"
#include "feeds/ChanMsgItem.h"
#include "feeds/ForumNewItem.h"
#include "feeds/ForumMsgItem.h"
#include "feeds/PeerItem.h"
#include "feeds/BlogMsgItem.h"
#include "GeneralMsgDialog.h"
const uint32_t NEWSFEED_PEERLIST = 0x0001;
const uint32_t NEWSFEED_FORUMNEWLIST = 0x0002;
const uint32_t NEWSFEED_FORUMMSGLIST = 0x0003;
const uint32_t NEWSFEED_CHANNEWLIST = 0x0004;
const uint32_t NEWSFEED_CHANMSGLIST = 0x0005;
const uint32_t NEWSFEED_BLOGMSGLIST = 0x0006;
/** Constructor */
NewsFeed::NewsFeed(QWidget *parent)
: MainPage (parent)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
/* mLayout -> to add widgets to */
mLayout = new QVBoxLayout;
QWidget *middleWidget = new QWidget();
//middleWidget->setSizePolicy( QSizePolicy::Policy::Maximum, QSizePolicy::Policy::Minimum);
middleWidget->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
middleWidget->setLayout(mLayout);
QScrollArea *scrollArea = new QScrollArea;
scrollArea->setBackgroundRole(QPalette::Dark);
scrollArea->setWidget(middleWidget);
scrollArea->setWidgetResizable(true);
scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
QVBoxLayout *layout2 = new QVBoxLayout;
layout2->addWidget(scrollArea);
frame->setLayout(layout2);
QTimer *timer = new QTimer(this);
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateFeed()));
timer->start(1000);
}
void NewsFeed::updateFeed()
{
if (!rsNotify)
return;
/* check for new messages */
RsFeedItem fi;
if (rsNotify->GetFeedItem(fi))
{
switch(fi.mType)
{
case RS_FEED_ITEM_PEER_CONNECT:
addFeedItemPeerConnect(fi);
break;
case RS_FEED_ITEM_PEER_DISCONNECT:
addFeedItemPeerDisconnect(fi);
break;
case RS_FEED_ITEM_PEER_NEW:
addFeedItemPeerNew(fi);
break;
case RS_FEED_ITEM_PEER_HELLO:
addFeedItemPeerHello(fi);
break;
case RS_FEED_ITEM_CHAN_NEW:
addFeedItemChanNew(fi);
break;
case RS_FEED_ITEM_CHAN_UPDATE:
addFeedItemChanUpdate(fi);
break;
case RS_FEED_ITEM_CHAN_MSG:
addFeedItemChanMsg(fi);
break;
case RS_FEED_ITEM_FORUM_NEW:
addFeedItemForumNew(fi);
break;
case RS_FEED_ITEM_FORUM_UPDATE:
addFeedItemForumUpdate(fi);
break;
case RS_FEED_ITEM_FORUM_MSG:
addFeedItemForumMsg(fi);
break;
case RS_FEED_ITEM_BLOG_MSG:
addFeedItemBlogMsg(fi);
break;
case RS_FEED_ITEM_CHAT_NEW:
addFeedItemChatNew(fi);
break;
case RS_FEED_ITEM_MESSAGE:
addFeedItemMessage(fi);
break;
case RS_FEED_ITEM_FILES_NEW:
addFeedItemFilesNew(fi);
break;
default:
break;
}
}
}
void NewsFeed::addFeedItemPeerConnect(RsFeedItem &fi)
{
/* make new widget */
PeerItem *pi = new PeerItem(this, NEWSFEED_PEERLIST, fi.mId1, PEER_TYPE_CONNECT, false);
/* store */
/* add to layout */
mLayout->addWidget(pi);
std::cerr << "NewsFeed::addFeedItemPeerConnect()";
std::cerr << std::endl;
}
void NewsFeed::addFeedItemPeerDisconnect(RsFeedItem &fi)
{
/* make new widget */
PeerItem *pi = new PeerItem(this, NEWSFEED_PEERLIST, fi.mId1, PEER_TYPE_STD, false);
/* store */
/* add to layout */
mLayout->addWidget(pi);
std::cerr << "NewsFeed::addFeedItemPeerDisconnect()";
std::cerr << std::endl;
}
void NewsFeed::addFeedItemPeerHello(RsFeedItem &fi)
{
/* make new widget */
PeerItem *pi = new PeerItem(this, NEWSFEED_PEERLIST, fi.mId1, PEER_TYPE_HELLO, false);
/* store */
/* add to layout */
mLayout->addWidget(pi);
std::cerr << "NewsFeed::addFeedItemPeerHello()";
std::cerr << std::endl;
}
void NewsFeed::addFeedItemPeerNew(RsFeedItem &fi)
{
/* make new widget */
PeerItem *pi = new PeerItem(this, NEWSFEED_PEERLIST, fi.mId1, PEER_TYPE_NEW_FOF, false);
/* store */
/* add to layout */
mLayout->addWidget(pi);
std::cerr << "NewsFeed::addFeedItemPeerNew()";
std::cerr << std::endl;
}
void NewsFeed::addFeedItemChanNew(RsFeedItem &fi)
{
std::cerr << "NewsFeed::addFeedItemChanNew()";
std::cerr << std::endl;
}
void NewsFeed::addFeedItemChanUpdate(RsFeedItem &fi)
{
std::cerr << "NewsFeed::addFeedItemChanUpdate()";
std::cerr << std::endl;
}
void NewsFeed::addFeedItemChanMsg(RsFeedItem &fi)
{
std::cerr << "NewsFeed::addFeedItemChanMsg()";
std::cerr << std::endl;
}
void NewsFeed::addFeedItemForumNew(RsFeedItem &fi)
{
/* make new widget */
ForumNewItem *fni = new ForumNewItem(this, NEWSFEED_FORUMNEWLIST, fi.mId1, false, true);
/* store in forum list */
mForumNewItems.push_back(fni);
/* add to layout */
mLayout->addWidget(fni);
std::cerr << "NewsFeed::addFeedItemForumNew()";
std::cerr << std::endl;
}
void NewsFeed::addFeedItemForumUpdate(RsFeedItem &fi)
{
/* make new widget */
ForumNewItem *fni = new ForumNewItem(this, NEWSFEED_FORUMNEWLIST, fi.mId1, false, false);
/* store in forum list */
mForumNewItems.push_back(fni);
/* add to layout */
mLayout->addWidget(fni);
std::cerr << "NewsFeed::addFeedItemForumUpdate()";
std::cerr << std::endl;
}
void NewsFeed::addFeedItemForumMsg(RsFeedItem &fi)
{
/* make new widget */
ForumMsgItem *fm = new ForumMsgItem(this, NEWSFEED_FORUMMSGLIST, fi.mId1, fi.mId2, false);
/* store in forum list */
/* add to layout */
mLayout->addWidget(fm);
std::cerr << "NewsFeed::addFeedItemForumMsg()";
std::cerr << std::endl;
}
void NewsFeed::addFeedItemBlogMsg(RsFeedItem &fi)
{
/* make new widget */
BlogMsgItem *bm = new BlogMsgItem(this, NEWSFEED_BLOGMSGLIST, fi.mId1, fi.mId2, false);
/* store in forum list */
/* add to layout */
mLayout->addWidget(bm);
std::cerr << "NewsFeed::addFeedItemBlogMsg()";
std::cerr << std::endl;
}
void NewsFeed::addFeedItemChatNew(RsFeedItem &fi)
{
std::cerr << "NewsFeed::addFeedItemChatNew()";
std::cerr << std::endl;
}
void NewsFeed::addFeedItemMessage(RsFeedItem &fi)
{
std::cerr << "NewsFeed::addFeedItemMessage()";
std::cerr << std::endl;
}
void NewsFeed::addFeedItemFilesNew(RsFeedItem &fi)
{
std::cerr << "NewsFeed::addFeedItemFilesNew()";
std::cerr << std::endl;
}
/* FeedHolder Functions (for FeedItem functionality) */
void NewsFeed::deleteFeedItem(QWidget *item, uint32_t type)
{
std::cerr << "NewsFeed::deleteFeedItem()";
std::cerr << std::endl;
}
void NewsFeed::openChat(std::string peerId)
{
std::cerr << "NewsFeed::openChat()";
std::cerr << std::endl;
}
void NewsFeed::openMsg(uint32_t type, std::string grpId, std::string inReplyTo)
{
std::cerr << "NewsFeed::openMsg()";
std::cerr << std::endl;
GeneralMsgDialog *msgDialog = new GeneralMsgDialog(NULL);
msgDialog->addDestination(type, grpId, inReplyTo);
msgDialog->show();
}

View File

@ -0,0 +1,84 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* 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 _NEWS_FEED_DIALOG_H
#define _NEWS_FEED_DIALOG_H
#include "mainpage.h"
#include "ui_NewsFeed.h"
#include "gui/feeds/FeedHolder.h"
class RsFeedItem;
class ForumNewItem;
class ChanMsgItem;
class NewsFeed : public MainPage, public FeedHolder, private Ui::NewsFeed
{
Q_OBJECT
public:
/** Default Constructor */
NewsFeed(QWidget *parent = 0);
/** Default Destructor */
/* FeedHolder Functions (for FeedItem functionality) */
virtual void deleteFeedItem(QWidget *item, uint32_t type);
virtual void openChat(std::string peerId);
virtual void openMsg(uint32_t type, std::string grpId, std::string inReplyTo);
private slots:
// void toggleChanMsgItems(bool on);
void updateFeed();
private:
void addFeedItemPeerConnect(RsFeedItem &fi);
void addFeedItemPeerDisconnect(RsFeedItem &fi);
void addFeedItemPeerNew(RsFeedItem &fi);
void addFeedItemPeerHello(RsFeedItem &fi);
void addFeedItemChanNew(RsFeedItem &fi);
void addFeedItemChanUpdate(RsFeedItem &fi);
void addFeedItemChanMsg(RsFeedItem &fi);
void addFeedItemForumNew(RsFeedItem &fi);
void addFeedItemForumUpdate(RsFeedItem &fi);
void addFeedItemForumMsg(RsFeedItem &fi);
void addFeedItemBlogMsg(RsFeedItem &fi);
void addFeedItemChatNew(RsFeedItem &fi);
void addFeedItemMessage(RsFeedItem &fi);
void addFeedItemFilesNew(RsFeedItem &fi);
;
QLayout *mLayout;
/* lists of feedItems */
std::list<ForumNewItem *> mForumNewItems;
std::list<ChanMsgItem *> mChanMsgItems;
};
#endif

View File

@ -0,0 +1,148 @@
<ui version="4.0" >
<class>NewsFeed</class>
<widget class="QWidget" name="NewsFeed" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>664</width>
<height>449</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<layout class="QVBoxLayout" >
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="label" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Enabled Feeds:</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="noneButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>No Feeds</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/deleteall.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="allButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>All Feeds</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/startall.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chanCheckBox" >
<property name="text" >
<string>Channels</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="forumCheckBox" >
<property name="text" >
<string>Forums</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="friendCheckBox" >
<property name="text" >
<string>Friends</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="blogCheckBox" >
<property name="text" >
<string>Blogs</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="msgCheckBox" >
<property name="text" >
<string>Messages</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chatCheckBox" >
<property name="text" >
<string>Chat</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="clearButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Clear Feed</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/deletemail24.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="frame" >
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="images.qrc" />
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,167 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* 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 <QtGui>
#include "BlogMsgItem.h"
#include "FeedHolder.h"
#include "SubFileItem.h"
#include <iostream>
#define DEBUG_ITEM 1
/** Constructor */
BlogMsgItem::BlogMsgItem(FeedHolder *parent, uint32_t feedId, std::string peerId, std::string msgId, bool isHome)
:QWidget(NULL), mParent(parent), mFeedId(feedId),
mPeerId(peerId), mMsgId(msgId), mIsHome(isHome)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
connect( gotoButton, SIGNAL( clicked( void ) ), this, SLOT( gotoHome ( void ) ) );
/* specific ones */
connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( playMedia ( void ) ) );
small();
updateItemStatic();
updateItem();
}
void BlogMsgItem::updateItemStatic()
{
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "BlogMsgItem::updateItemStatic()";
std::cerr << std::endl;
#endif
msgLabel->setText("FFFFFFFFFFF AAAAAAAAAAAAAAA \n HHHHHHHHHHH HHHHHHHHHHHHHHHHH");
titleLabel->setText("Channel Feed: Best Channel Ever");
subjectLabel->setText("Brand new exciting Ever");
/* add Files */
int total = (int) (10.0 * (rand() / (RAND_MAX + 1.0)));
int i;
for(i = 0; i < total; i++)
{
/* add file */
SubFileItem *fi = new SubFileItem("dummyHash");
mFileItems.push_back(fi);
QLayout *layout = expandFrame->layout();
layout->addWidget(fi);
}
playButton->setEnabled(false);
if (mIsHome)
{
/* disable buttons */
clearButton->setEnabled(false);
gotoButton->setEnabled(false);
}
}
void BlogMsgItem::updateItem()
{
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "BlogMsgItem::updateItem()";
std::cerr << std::endl;
#endif
int msec_rate = 10000;
/* Very slow Tick to check when all files are downloaded */
std::list<SubFileItem *>::iterator it;
for(it = mFileItems.begin(); it != mFileItems.end(); it++)
{
if (!(*it)->done())
{
/* loop again */
QTimer::singleShot( msec_rate, this, SLOT(updateItem( void ) ));
return;
}
}
playButton->setEnabled(true);
}
void BlogMsgItem::small()
{
expandFrame->hide();
}
void BlogMsgItem::toggle()
{
if (expandFrame->isHidden())
{
expandFrame->show();
}
else
{
expandFrame->hide();
}
}
void BlogMsgItem::removeItem()
{
#ifdef DEBUG_ITEM
std::cerr << "BlogMsgItem::removeItem()";
std::cerr << std::endl;
#endif
hide();
if (mParent)
{
mParent->deleteFeedItem(this, mFeedId);
}
}
void BlogMsgItem::gotoHome()
{
#ifdef DEBUG_ITEM
std::cerr << "BlogMsgItem::gotoHome()";
std::cerr << std::endl;
#endif
}
/*********** SPECIFIC FUNCTIOSN ***********************/
void BlogMsgItem::playMedia()
{
#ifdef DEBUG_ITEM
std::cerr << "BlogMsgItem::playMedia()";
std::cerr << std::endl;
#endif
}

View File

@ -0,0 +1,70 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* 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 _BLOG_MSG_ITEM_DIALOG_H
#define _BLOG_MSG_ITEM_DIALOG_H
#include "ui_BlogMsgItem.h"
#include <string>
class FeedHolder;
class SubFileItem;
class BlogMsgItem : public QWidget, private Ui::BlogMsgItem
{
Q_OBJECT
public:
/** Default Constructor */
BlogMsgItem(FeedHolder *parent, uint32_t feedId, std::string peerId, std::string msgId, bool isHome);
/** Default Destructor */
void updateItemStatic();
void small();
private slots:
/* default stuff */
void gotoHome();
void removeItem();
void toggle();
void playMedia();
void updateItem();
private:
FeedHolder *mParent;
uint32_t mFeedId;
std::string mPeerId;
std::string mMsgId;
bool mIsHome;
std::list<SubFileItem *> mFileItems;
};
#endif

View File

@ -0,0 +1,266 @@
<ui version="4.0" >
<class>BlogMsgItem</class>
<widget class="QWidget" name="BlogMsgItem" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>917</width>
<height>238</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<layout class="QGridLayout" >
<property name="topMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item row="0" column="0" >
<widget class="QFrame" name="frame" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" >
<property name="topMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QPushButton" name="gotoButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Goto Section</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/add-friend24.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>16</width>
<height>26</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="titleLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font" >
<font>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Connected</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>1000</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="clearButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Delete FeedItem</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/close_normal.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="expandButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Expand</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/add_24x24.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Subject</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="subjectLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>subjectLabel</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>500</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="playButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Play Media</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/startall.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="expandFrame" >
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QLabel" name="msgLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Long
message here</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="images.qrc" />
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,70 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* 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 <QtGui>
#include "ChanGroupItem.h"
#include "SubFileItem.h"
#include <iostream>
#define DEBUG_ITEM 1
/** Constructor */
ChanGroupItem::ChanGroupItem(std::string groupName)
:QWidget(NULL), mGroupName(groupName)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
small();
updateItemStatic();
updateItem();
}
void ChanGroupItem::updateItemStatic()
{
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "ChanGroupItem::updateItemStatic()";
std::cerr << std::endl;
#endif
titleLabel->setText(QString::fromStdString(mGroupName));
}
void ChanGroupItem::updateItem()
{
}
void ChanGroupItem::small()
{
}
void ChanGroupItem::toggle()
{
}

View File

@ -0,0 +1,55 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* 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 _CHAN_GROUP_ITEM_DIALOG_H
#define _CHAN_GROUP_ITEM_DIALOG_H
#include "ui_ChanGroupItem.h"
#include <string>
class ChanGroupItem : public QWidget, private Ui::ChanGroupItem
{
Q_OBJECT
public:
/** Default Constructor */
ChanGroupItem(std::string grpName);
/** Default Destructor */
void updateItemStatic();
void small();
private slots:
/* default stuff */
void toggle();
void updateItem();
private:
std::string mGroupName;
};
#endif

View File

@ -0,0 +1,125 @@
<ui version="4.0" >
<class>ChanGroupItem</class>
<widget class="QWidget" name="ChanGroupItem" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>275</width>
<height>53</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<layout class="QGridLayout" >
<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 row="0" column="0" >
<widget class="QFrame" name="frame" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" >
<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="expandButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Expand</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/add_24x24.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="titleLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font" >
<font>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Channel Group</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>231</width>
<height>71</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="images.qrc" />
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,87 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* 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 <QtGui>
#include "ChanMenuItem.h"
#include <iostream>
#define DEBUG_ITEM 1
/** Constructor */
ChanMenuItem::ChanMenuItem(std::string chanId)
:QWidget(NULL), mChanId(chanId)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
small();
updateItemStatic();
updateItem();
}
void ChanMenuItem::updateItemStatic()
{
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "ChanMenuItem::updateItemStatic()";
std::cerr << std::endl;
#endif
titleLabel->setText(QString::fromStdString(mChanId));
descLabel->setText("Brand new exciting Ever asvljh ljdsafl kjdsahfl kjsahf; kjsahdf; kljashfdl;kjhasfkl; asvljh ljdsafl kjdsahfl kjsahf; kjsahdf; kljashfdl;kjhasfkl; asvljh ljdsafl kjdsahfl kjsahf; kjsahdf; kljashfdl;kjhasfkl; asvljh ljdsafl kjdsahfl kjsahf; kjsahdf; kljashfdl;kjhasfkl; asvljh ljdsafl kjdsahfl kjsahf; kjsahdf; kljashfdl;kjhasfkl; asvljh ljdsafl kjdsahfl kjsahf; kjsahdf; kljashfdl;kjhasfkl; asvljh ljdsafl kjdsahfl kjsahf; kjsahdf; kljashfdl;kjhasfkl; asvljh ljdsafl kjdsahfl kjsahf; kjsahdf; kljashfdl;kjhasfkl; ");
}
void ChanMenuItem::updateItem()
{
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "ChanMenuItem::updateItem()";
std::cerr << std::endl;
#endif
}
void ChanMenuItem::small()
{
expandFrame->hide();
}
void ChanMenuItem::toggle()
{
if (expandFrame->isHidden())
{
expandFrame->show();
}
else
{
expandFrame->hide();
}
}
/*********** SPECIFIC FUNCTIOSN ***********************/

View File

@ -0,0 +1,57 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* 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 _CHAN_MENU_ITEM_DIALOG_H
#define _CHAN_MENU_ITEM_DIALOG_H
#include "ui_ChanMenuItem.h"
#include <string>
class SubFileItem;
class ChanMenuItem : public QWidget, private Ui::ChanMenuItem
{
Q_OBJECT
public:
/** Default Constructor */
ChanMenuItem(std::string chanId);
/** Default Destructor */
void updateItemStatic();
void small();
private slots:
/* default stuff */
void toggle();
void updateItem();
private:
std::string mChanId;
};
#endif

View File

@ -0,0 +1,209 @@
<ui version="4.0" >
<class>ChanMenuItem</class>
<widget class="QWidget" name="ChanMenuItem" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>483</width>
<height>262</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<layout class="QGridLayout" >
<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 row="0" column="0" >
<widget class="QFrame" name="frame" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" >
<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" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="expandButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Expand</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/advsearch_24x24.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="titleLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize" >
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="font" >
<font>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Connected</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>151</width>
<height>26</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="expandFrame" >
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" >
<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>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="iconLabel" >
<property name="text" >
<string/>
</property>
<property name="pixmap" >
<pixmap resource="images.qrc" >:/images/contacts24.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="descLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize" >
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="text" >
<string>Description
of Forum</string>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="images.qrc" />
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,177 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* 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 <QtGui>
#include "ChanMsgItem.h"
#include "FeedHolder.h"
#include "SubFileItem.h"
#include <iostream>
#define DEBUG_ITEM 1
/** Constructor */
ChanMsgItem::ChanMsgItem(FeedHolder *parent, uint32_t feedId, std::string chanId, std::string msgId, bool isHome)
:QWidget(NULL), mParent(parent), mFeedId(feedId),
mChanId(chanId), mMsgId(msgId), mIsHome(isHome)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
connect( gotoButton, SIGNAL( clicked( void ) ), this, SLOT( gotoHome ( void ) ) );
/* specific ones */
connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( playMedia ( void ) ) );
connect( unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeChannel ( void ) ) );
small();
updateItemStatic();
updateItem();
}
void ChanMsgItem::updateItemStatic()
{
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "ChanMsgItem::updateItemStatic()";
std::cerr << std::endl;
#endif
msgLabel->setText("FFFFFFFFFFF AAAAAAAAAAAAAAA \n HHHHHHHHHHH HHHHHHHHHHHHHHHHH");
titleLabel->setText("Channel Feed: Best Channel Ever");
subjectLabel->setText("Brand new exciting Ever");
/* add Files */
int total = (int) (10.0 * (rand() / (RAND_MAX + 1.0)));
int i;
for(i = 0; i < total; i++)
{
/* add file */
SubFileItem *fi = new SubFileItem("dummyHash");
mFileItems.push_back(fi);
QLayout *layout = expandFrame->layout();
layout->addWidget(fi);
}
playButton->setEnabled(false);
if (mIsHome)
{
/* disable buttons */
clearButton->setEnabled(false);
gotoButton->setEnabled(false);
}
}
void ChanMsgItem::updateItem()
{
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "ChanMsgItem::updateItem()";
std::cerr << std::endl;
#endif
int msec_rate = 10000;
/* Very slow Tick to check when all files are downloaded */
std::list<SubFileItem *>::iterator it;
for(it = mFileItems.begin(); it != mFileItems.end(); it++)
{
if (!(*it)->done())
{
/* loop again */
QTimer::singleShot( msec_rate, this, SLOT(updateItem( void ) ));
return;
}
}
playButton->setEnabled(true);
}
void ChanMsgItem::small()
{
expandFrame->hide();
}
void ChanMsgItem::toggle()
{
if (expandFrame->isHidden())
{
expandFrame->show();
}
else
{
expandFrame->hide();
}
}
void ChanMsgItem::removeItem()
{
#ifdef DEBUG_ITEM
std::cerr << "ChanMsgItem::removeItem()";
std::cerr << std::endl;
#endif
hide();
if (mParent)
{
mParent->deleteFeedItem(this, mFeedId);
}
}
void ChanMsgItem::gotoHome()
{
#ifdef DEBUG_ITEM
std::cerr << "ChanMsgItem::gotoHome()";
std::cerr << std::endl;
#endif
}
/*********** SPECIFIC FUNCTIOSN ***********************/
void ChanMsgItem::unsubscribeChannel()
{
#ifdef DEBUG_ITEM
std::cerr << "ChanMsgItem::unsubscribeChannel()";
std::cerr << std::endl;
#endif
}
void ChanMsgItem::playMedia()
{
#ifdef DEBUG_ITEM
std::cerr << "ChanMsgItem::playMedia()";
std::cerr << std::endl;
#endif
}

View File

@ -0,0 +1,71 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* 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 _CHAN_MSG_ITEM_DIALOG_H
#define _CHAN_MSG_ITEM_DIALOG_H
#include "ui_ChanMsgItem.h"
#include <string>
class FeedHolder;
class SubFileItem;
class ChanMsgItem : public QWidget, private Ui::ChanMsgItem
{
Q_OBJECT
public:
/** Default Constructor */
ChanMsgItem(FeedHolder *parent, uint32_t feedId, std::string chanId, std::string msgId, bool isHome);
/** Default Destructor */
void updateItemStatic();
void small();
private slots:
/* default stuff */
void gotoHome();
void removeItem();
void toggle();
void playMedia();
void unsubscribeChannel();
void updateItem();
private:
FeedHolder *mParent;
uint32_t mFeedId;
std::string mChanId;
std::string mMsgId;
bool mIsHome;
std::list<SubFileItem *> mFileItems;
};
#endif

View File

@ -0,0 +1,301 @@
<ui version="4.0" >
<class>ChanMsgItem</class>
<widget class="QWidget" name="ChanMsgItem" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>917</width>
<height>238</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<layout class="QGridLayout" >
<property name="topMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item row="0" column="0" >
<widget class="QFrame" name="frame" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" >
<property name="topMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QPushButton" name="gotoButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Goto Section</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/add-friend24.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>16</width>
<height>26</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="titleLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font" >
<font>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Connected</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>1000</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="clearButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Delete FeedItem</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/close_normal.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="expandButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Expand</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/add_24x24.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Subject</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="subjectLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>subjectLabel</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>500</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="unsubscribeButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Unsubscribe From Channel</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/mail_delete.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="playButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Play Media</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/startall.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="expandFrame" >
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QLabel" name="msgLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Long
message here</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="images.qrc" />
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,289 @@
<ui version="4.0" >
<class>MsgItem</class>
<widget class="QWidget" name="MsgItem" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>603</width>
<height>358</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QFrame" name="frame" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" >
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QPushButton" name="gotoButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Goto Section</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/add-friend24.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>16</width>
<height>26</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="typeLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font" >
<font>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Connected</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>500</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="clearButton" >
<property name="toolTip" >
<string>Remove</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/close_normal.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>16</width>
<height>26</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="expandButton" >
<property name="toolTip" >
<string>Expand</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/add_24x24.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="label_2" >
<property name="text" >
<string/>
</property>
<property name="pixmap" >
<pixmap resource="images.qrc" >:/images/advsearch_24x24.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="catLabel" >
<property name="text" >
<string>Category</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>200</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_3" >
<property name="text" >
<string/>
</property>
<property name="pixmap" >
<pixmap/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="nameLabel" >
<property name="text" >
<string>Name</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>200</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="subscribeButton" >
<property name="toolTip" >
<string>Subscribe To Channel</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/channelsubscribe.png</iconset>
</property>
<property name="iconSize" >
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="frame_2" >
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" >
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="iconLabel" >
<property name="text" >
<string/>
</property>
<property name="pixmap" >
<pixmap resource="images.qrc" >:/images/channels.png</pixmap>
</property>
<property name="scaledContents" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="descLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Description
of Channel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="images.qrc" />
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,42 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* 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 _FEED_HOLDER_H
#define _FEED_HOLDER_H
#include <string>
const uint32_t FEEDHOLDER_MSG_MESSAGE = 0x0001;
const uint32_t FEEDHOLDER_MSG_FORUM = 0x0002;
const uint32_t FEEDHOLDER_MSG_CHANNEL = 0x0003;
const uint32_t FEEDHOLDER_MSG_BLOG = 0x0004;
class FeedHolder
{
public:
virtual void deleteFeedItem(QWidget *item, uint32_t type) = 0;
virtual void openChat(std::string peerId) = 0;
virtual void openMsg(uint32_t type, std::string grpId, std::string inReplyTo) = 0;
};
#endif

View File

@ -0,0 +1,250 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* 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 <QtGui>
#include "ForumMsgItem.h"
#include "FeedHolder.h"
#include "rsiface/rsforums.h"
#include <iostream>
#define DEBUG_ITEM 1
/** Constructor */
ForumMsgItem::ForumMsgItem(FeedHolder *parent, uint32_t feedId, std::string forumId, std::string postId, bool isHome)
:QWidget(NULL), mParent(parent), mFeedId(feedId),
mForumId(forumId), mPostId(postId), mIsHome(isHome), mIsTop(false)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
connect( gotoButton, SIGNAL( clicked( void ) ), this, SLOT( gotoHome ( void ) ) );
/* specific ones */
connect( unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeForum ( void ) ) );
connect( replyButton, SIGNAL( clicked( void ) ), this, SLOT( replyToPost ( void ) ) );
small();
updateItemStatic();
updateItem();
}
void ForumMsgItem::updateItemStatic()
{
if (!rsForums)
return;
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "ForumMsgItem::updateItemStatic()";
std::cerr << std::endl;
#endif
ForumInfo fi;
if (rsForums->getForumInfo(mForumId, fi))
{
QString title = "Forum Post: ";
title += QString::fromStdWString(fi.forumName);
titleLabel->setText(title);
if (!(fi.forumFlags & RS_DISTRIB_SUBSCRIBED))
{
unsubscribeButton->setEnabled(false);
replyButton->setEnabled(false);
}
else
{
unsubscribeButton->setEnabled(true);
replyButton->setEnabled(true);
}
}
else
{
titleLabel->setText("Unknown Forum Post");
}
/* get actual Message */
ForumMsgInfo msg;
if (rsForums->getForumMessage(mForumId, mPostId, msg))
{
#ifdef DEBUG_ITEM
std::cerr << "Ids: MsgId: " << msg.msgId;
std::cerr << std::endl;
std::cerr << "Ids: ParentId: " << msg.parentId;
std::cerr << std::endl;
std::cerr << "Ids: ThreadId: " << msg.threadId;
std::cerr << std::endl;
#endif
/* decide if top or not */
if ((msg.msgId == msg.threadId) || (msg.threadId == ""))
{
mIsTop = true;
}
if (mIsTop)
{
prevSHLabel->setText("Subject: ");
prevSubLabel->setText(QString::fromStdWString(msg.title));
prevMsgLabel->setText(QString::fromStdWString(msg.msg));
nextFrame->hide();
}
else
{
nextSubLabel->setText(QString::fromStdWString(msg.title));
nextMsgLabel->setText(QString::fromStdWString(msg.msg));
prevSHLabel->setText("In Reply To: ");
ForumMsgInfo msgParent;
if (rsForums->getForumMessage(mForumId, msg.parentId, msgParent))
{
prevSubLabel->setText(QString::fromStdWString(msgParent.title));
prevMsgLabel->setText(QString::fromStdWString(msgParent.msg));
}
else
{
prevSubLabel->setText("???");
prevMsgLabel->setText("???");
}
}
/* header stuff */
subjectLabel->setText(QString::fromStdWString(msg.title));
srcLabel->setText(QString::fromStdString(msg.srcId));
}
if (mIsHome)
{
/* disable buttons */
clearButton->setEnabled(false);
gotoButton->setEnabled(false);
}
}
void ForumMsgItem::updateItem()
{
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "ForumMsgItem::updateItem()";
std::cerr << std::endl;
#endif
}
void ForumMsgItem::small()
{
nextFrame->hide();
prevFrame->hide();
}
void ForumMsgItem::toggle()
{
if (prevFrame->isHidden())
{
prevFrame->show();
if (!mIsTop)
{
nextFrame->show();
}
}
else
{
prevFrame->hide();
nextFrame->hide();
}
}
void ForumMsgItem::removeItem()
{
#ifdef DEBUG_ITEM
std::cerr << "ForumMsgItem::removeItem()";
std::cerr << std::endl;
#endif
hide();
if (mParent)
{
mParent->deleteFeedItem(this, mFeedId);
}
}
void ForumMsgItem::gotoHome()
{
#ifdef DEBUG_ITEM
std::cerr << "ForumMsgItem::gotoHome()";
std::cerr << std::endl;
#endif
}
/*********** SPECIFIC FUNCTIOSN ***********************/
void ForumMsgItem::unsubscribeForum()
{
#ifdef DEBUG_ITEM
std::cerr << "ForumMsgItem::unsubscribeForum()";
std::cerr << std::endl;
#endif
if (rsForums)
{
rsForums->forumSubscribe(mForumId, false);
}
updateItemStatic();
}
void ForumMsgItem::subscribeForum()
{
#ifdef DEBUG_ITEM
std::cerr << "ForumMsgItem::subscribeForum()";
std::cerr << std::endl;
#endif
if (rsForums)
{
rsForums->forumSubscribe(mForumId, true);
}
updateItemStatic();
}
void ForumMsgItem::replyToPost()
{
#ifdef DEBUG_ITEM
std::cerr << "ForumMsgItem::replyToPost()";
std::cerr << std::endl;
#endif
if (mParent)
{
mParent->openMsg(FEEDHOLDER_MSG_FORUM, mForumId, mPostId);
}
}

View File

@ -0,0 +1,69 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* 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 _FORUM_MSG_ITEM_DIALOG_H
#define _FORUM_MSG_ITEM_DIALOG_H
#include "ui_ForumMsgItem.h"
class FeedHolder;
#include <string>
class ForumMsgItem : public QWidget, private Ui::ForumMsgItem
{
Q_OBJECT
public:
/** Default Constructor */
ForumMsgItem(FeedHolder *parent, uint32_t feedId, std::string forumId, std::string postId, bool isHome);
/** Default Destructor */
void updateItemStatic();
void small();
private slots:
/* default stuff */
void gotoHome();
void removeItem();
void toggle();
void unsubscribeForum();
void subscribeForum();
void replyToPost();
void updateItem();
private:
FeedHolder *mParent;
uint32_t mFeedId;
std::string mForumId;
std::string mPostId;
bool mIsHome;
bool mIsTop;
};
#endif

View File

@ -0,0 +1,492 @@
<ui version="4.0" >
<class>ForumMsgItem</class>
<widget class="QWidget" name="ForumMsgItem" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>633</width>
<height>340</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<layout class="QGridLayout" >
<property name="topMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item row="0" column="0" >
<widget class="QFrame" name="frame_3" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" >
<property name="topMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QPushButton" name="gotoButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Goto Section</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/add-friend24.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>16</width>
<height>26</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="titleLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font" >
<font>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Forum Name</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>500</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="clearButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Remove</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/close_normal.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="expandButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Expand</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/add_24x24.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="label_2" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Subject: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="subjectLabel" >
<property name="text" >
<string>Subject...</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>200</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="srcLabel" >
<property name="text" >
<string>Persons Name</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>200</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="unsubscribeButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Unsubscribe To Forum</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/mail_delete.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="replyButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Reply</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/replymail24.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="prevFrame" >
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" >
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="prevSHLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Subject: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="prevSubLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Message is about ???</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="prevMsgLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Previous Message...</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="nextFrame" >
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" >
<item>
<layout class="QHBoxLayout" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_9" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Subject: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="nextSubLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Message is about ???</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="nextMsgLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Currnent Message..</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="images.qrc" />
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,206 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* 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 <QtGui>
#include "ForumNewItem.h"
#include "FeedHolder.h"
#include "rsiface/rsforums.h"
#include <iostream>
#define DEBUG_ITEM 1
/** Constructor */
ForumNewItem::ForumNewItem(FeedHolder *parent, uint32_t feedId, std::string forumId, bool isHome, bool isNew)
:QWidget(NULL), mParent(parent), mFeedId(feedId),
mForumId(forumId), mIsHome(isHome), mIsNew(isNew)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
connect( gotoButton, SIGNAL( clicked( void ) ), this, SLOT( gotoHome ( void ) ) );
/* specific ones */
connect( subscribeButton, SIGNAL( clicked( void ) ), this, SLOT( subscribeForum ( void ) ) );
// To Cheeky to post on a brand new forum....
//connect( postButton, SIGNAL( clicked( void ) ), this, SLOT( postToForum ( void ) ) );
small();
updateItemStatic();
updateItem();
}
void ForumNewItem::updateItemStatic()
{
if (!rsForums)
return;
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "ForumNewItem::updateItemStatic()";
std::cerr << std::endl;
#endif
ForumInfo fi;
if (rsForums->getForumInfo(mForumId, fi))
{
nameLabel->setText(QString::fromStdWString(fi.forumName));
descLabel->setText(QString::fromStdWString(fi.forumDesc));
if (fi.forumFlags & RS_DISTRIB_SUBSCRIBED)
{
subscribeButton->setEnabled(false);
//postButton->setEnabled(true);
}
else
{
subscribeButton->setEnabled(true);
//postButton->setEnabled(false);
}
/* should also check the other flags */
}
else
{
nameLabel->setText("Unknown Forum");
titleLabel->setText("New Forum");
descLabel->setText("");
}
if (mIsNew)
{
titleLabel->setText("New Forum");
}
else
{
titleLabel->setText("Updated Forum");
}
if (mIsHome)
{
/* disable buttons */
clearButton->setEnabled(false);
gotoButton->setEnabled(false);
}
}
void ForumNewItem::updateItem()
{
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "ForumNewItem::updateItem()";
std::cerr << std::endl;
#endif
}
void ForumNewItem::small()
{
expandFrame->hide();
}
void ForumNewItem::toggle()
{
if (expandFrame->isHidden())
{
expandFrame->show();
}
else
{
expandFrame->hide();
}
}
void ForumNewItem::removeItem()
{
#ifdef DEBUG_ITEM
std::cerr << "ForumNewItem::removeItem()";
std::cerr << std::endl;
#endif
hide();
if (mParent)
{
mParent->deleteFeedItem(this, mFeedId);
}
}
void ForumNewItem::gotoHome()
{
#ifdef DEBUG_ITEM
std::cerr << "ForumNewItem::gotoHome()";
std::cerr << std::endl;
#endif
}
/*********** SPECIFIC FUNCTIOSN ***********************/
void ForumNewItem::unsubscribeForum()
{
#ifdef DEBUG_ITEM
std::cerr << "ForumNewItem::unsubscribeForum()";
std::cerr << std::endl;
#endif
if (rsForums)
{
rsForums->forumSubscribe(mForumId, false);
}
updateItemStatic();
}
void ForumNewItem::subscribeForum()
{
#ifdef DEBUG_ITEM
std::cerr << "ForumNewItem::subscribeForum()";
std::cerr << std::endl;
#endif
if (rsForums)
{
rsForums->forumSubscribe(mForumId, true);
}
updateItemStatic();
}
void ForumNewItem::postToForum()
{
#ifdef DEBUG_ITEM
std::cerr << "ForumNewItem::subscribeForum()";
std::cerr << std::endl;
#endif
if (mParent)
{
mParent->openMsg(FEEDHOLDER_MSG_FORUM, mForumId, "");
}
}

View File

@ -0,0 +1,68 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* 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 _FORUM_NEW_ITEM_DIALOG_H
#define _FORUM_NEW_ITEM_DIALOG_H
#include "ui_ForumNewItem.h"
#include <string>
class FeedHolder;
class ForumNewItem : public QWidget, private Ui::ForumNewItem
{
Q_OBJECT
public:
/** Default Constructor */
ForumNewItem(FeedHolder *parent, uint32_t feedId, std::string forumId, bool isHome, bool isNew);
/** Default Destructor */
void updateItemStatic();
void small();
private slots:
/* default stuff */
void gotoHome();
void removeItem();
void toggle();
void unsubscribeForum();
void subscribeForum();
void postToForum();
void updateItem();
private:
FeedHolder *mParent;
uint32_t mFeedId;
std::string mForumId;
bool mIsHome;
bool mIsNew;
};
#endif

View File

@ -0,0 +1,294 @@
<ui version="4.0" >
<class>ForumNewItem</class>
<widget class="QWidget" name="ForumNewItem" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>634</width>
<height>354</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<layout class="QGridLayout" >
<property name="topMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item row="0" column="0" >
<widget class="QFrame" name="frame" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" >
<property name="topMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QPushButton" name="gotoButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Goto Section</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/add-friend24.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>16</width>
<height>26</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="titleLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font" >
<font>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Connected</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="nameLabel" >
<property name="text" >
<string>name</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>500</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="subscribeButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Subscribe to Forum</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/directoryadd_24x24_shadow.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="clearButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Remove</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/close_normal.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="expandButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Expand</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/add_24x24.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="expandFrame" >
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" >
<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>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="iconLabel" >
<property name="text" >
<string/>
</property>
<property name="pixmap" >
<pixmap resource="images.qrc" >:/images/contacts24.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="descLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Description
of Forum</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="images.qrc" />
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,288 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* 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 <QtGui>
#include "PeerItem.h"
#include "FeedHolder.h"
#include "rsiface/rspeers.h"
#include <iostream>
#include <sstream>
#define DEBUG_ITEM 1
/** Constructor */
PeerItem::PeerItem(FeedHolder *parent, uint32_t feedId, std::string peerId, uint32_t type, bool isHome)
:QWidget(NULL), mParent(parent), mFeedId(feedId),
mPeerId(peerId), mType(type), mIsHome(isHome)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
/* general ones */
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
connect( gotoButton, SIGNAL( clicked( void ) ), this, SLOT( gotoHome ( void ) ) );
/* specific ones */
connect( chatButton, SIGNAL( clicked( void ) ), this, SLOT( openChat ( void ) ) );
connect( msgButton, SIGNAL( clicked( void ) ), this, SLOT( sendMsg ( void ) ) );
connect( addButton, SIGNAL( clicked( void ) ), this, SLOT( addFriend ( void ) ) );
connect( removeButton, SIGNAL( clicked( void ) ), this, SLOT( removeFriend ( void ) ) );
small();
updateItemStatic();
updateItem();
}
void PeerItem::updateItemStatic()
{
if (!rsPeers)
return;
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "PeerItem::updateItemStatic()";
std::cerr << std::endl;
#endif
RsPeerDetails details;
if (rsPeers->getPeerDetails(mPeerId, details))
{
QString title;
switch(mType)
{
case PEER_TYPE_STD:
title = "Friend: ";
break;
case PEER_TYPE_CONNECT:
title = "Friend Connected: ";
break;
case PEER_TYPE_HELLO:
title = "Connect Attempt: ";
break;
case PEER_TYPE_NEW_FOF:
title = "Friend of Friend: ";
break;
default:
title = "Peer: ";
break;
}
title += QString::fromStdString(details.name);
titleLabel->setText(title);
/* expanded Info */
nameLabel->setText(QString::fromStdString(details.name));
idLabel->setText(QString::fromStdString(details.id));
orgLabel->setText(QString::fromStdString(details.org));
locLabel->setText(QString::fromStdString(details.location));
countryLabel->setText("");
}
else
{
statusLabel->setText("Unknown Peer");
titleLabel->setText("Unknown Peer");
trustLabel->setText("Unknown Peer");
nameLabel->setText("Unknown Peer");
idLabel->setText("Unknown Peer");
orgLabel->setText("Unknown Peer");
locLabel->setText("Unknown Peer");
countryLabel->setText("Unknown Peer");
ipLabel->setText("Unknown Peer");
connLabel->setText("Unknown Peer");
lastLabel->setText("Unknown Peer");
chatButton->setEnabled(false);
addButton->setEnabled(false);
removeButton->setEnabled(false);
msgButton->setEnabled(false);
}
if (mIsHome)
{
/* disable buttons */
clearButton->setEnabled(false);
gotoButton->setEnabled(false);
}
}
void PeerItem::updateItem()
{
if (!rsPeers)
return;
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "PeerItem::updateItem()";
std::cerr << std::endl;
#endif
RsPeerDetails details;
if (!rsPeers->getPeerDetails(mPeerId, details))
{
return;
}
/* top Level info */
QString status = QString::fromStdString(RsPeerStateString(details.state));
#if 0
/* Append additional status info from status service */
StatusInfo statusInfo;
if ((rsStatus) && (rsStatus->getStatus(*it, statusInfo)))
{
status.append(QString::fromStdString("/" + RsStatusString(statusInfo.status)));
}
#endif
statusLabel->setText(status);
trustLabel->setText(QString::fromStdString(
RsPeerTrustString(details.trustLvl)));
{
std::ostringstream out;
out << details.localAddr << ":";
out << details.localPort << "/";
out << details.extAddr << ":";
out << details.extPort;
ipLabel->setText(QString::fromStdString(out.str()));
}
time_t now = time(NULL);
connLabel->setText(QString::fromStdString(details.autoconnect));
lastLabel->setText(QString::fromStdString(
RsPeerLastConnectString(now - details.lastConnect)));
/* do buttons */
chatButton->setEnabled(details.state & RS_PEER_STATE_CONNECTED);
if (details.state & RS_PEER_STATE_FRIEND)
{
addButton->setEnabled(false);
removeButton->setEnabled(true);
msgButton->setEnabled(true);
}
else
{
addButton->setEnabled(true);
removeButton->setEnabled(false);
msgButton->setEnabled(false);
}
/* slow Tick */
int msec_rate = 10129;
QTimer::singleShot( msec_rate, this, SLOT(updateItem( void ) ));
return;
}
void PeerItem::small()
{
expandFrame->hide();
}
void PeerItem::toggle()
{
if (expandFrame->isHidden())
{
expandFrame->show();
}
else
{
expandFrame->hide();
}
}
void PeerItem::removeItem()
{
#ifdef DEBUG_ITEM
std::cerr << "PeerItem::removeItem()";
std::cerr << std::endl;
#endif
hide();
if (mParent)
{
mParent->deleteFeedItem(this, mFeedId);
}
}
void PeerItem::gotoHome()
{
#ifdef DEBUG_ITEM
std::cerr << "PeerItem::gotoHome()";
std::cerr << std::endl;
#endif
}
/*********** SPECIFIC FUNCTIOSN ***********************/
void PeerItem::addFriend()
{
#ifdef DEBUG_ITEM
std::cerr << "PeerItem::addFriend()";
std::cerr << std::endl;
#endif
}
void PeerItem::removeFriend()
{
#ifdef DEBUG_ITEM
std::cerr << "PeerItem::removeFriend()";
std::cerr << std::endl;
#endif
}
void PeerItem::sendMsg()
{
#ifdef DEBUG_ITEM
std::cerr << "PeerItem::sendMsg()";
std::cerr << std::endl;
#endif
if (mParent)
{
mParent->openMsg(FEEDHOLDER_MSG_MESSAGE, mPeerId, "");
}
}
void PeerItem::openChat()
{
#ifdef DEBUG_ITEM
std::cerr << "PeerItem::openChat()";
std::cerr << std::endl;
#endif
if (mParent)
{
mParent->openChat(mPeerId);
}
}

View File

@ -0,0 +1,75 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* 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 _PEER_ITEM_DIALOG_H
#define _PEER_ITEM_DIALOG_H
#include "ui_PeerItem.h"
#include <string>
const uint32_t PEER_TYPE_STD = 0x0001;
const uint32_t PEER_TYPE_CONNECT = 0x0002;
const uint32_t PEER_TYPE_HELLO = 0x0003; /* failed Connect Attempt */
const uint32_t PEER_TYPE_NEW_FOF = 0x0004; /* new Friend of Friend */
class FeedHolder;
class PeerItem : public QWidget, private Ui::PeerItem
{
Q_OBJECT
public:
/** Default Constructor */
PeerItem(FeedHolder *parent, uint32_t feedId, std::string peerId, uint32_t type, bool isHome);
/** Default Destructor */
void updateItemStatic();
void small();
private slots:
/* default stuff */
void gotoHome();
void removeItem();
void toggle();
void addFriend();
void removeFriend();
void sendMsg();
void openChat();
void updateItem();
private:
FeedHolder *mParent;
uint32_t mFeedId;
std::string mPeerId;
uint32_t mType;
bool mIsHome;
};
#endif

View File

@ -0,0 +1,654 @@
<ui version="4.0" >
<class>PeerItem</class>
<widget class="QWidget" name="PeerItem" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>835</width>
<height>551</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<layout class="QGridLayout" >
<property name="topMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item row="0" column="0" >
<widget class="QFrame" name="frame" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" >
<property name="topMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QPushButton" name="gotoButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Goto Section</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/add-friend24.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>16</width>
<height>26</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="titleLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font" >
<font>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Connected</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>500</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="clearButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Remove</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/close_normal.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="expandButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Expand</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/add_24x24.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="typeLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font" >
<font>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Status:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="statusLabel" >
<property name="text" >
<string>Connected</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Trust: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="trustLabel" >
<property name="text" >
<string>Good</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>500</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="addButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Make Friend</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/add-friend24.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="removeButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Remove Friend</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/ddeny.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>60</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="msgButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Send Mail</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/mail_send.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="chatButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Chat</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/chat.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="expandFrame" >
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" >
<item>
<layout class="QHBoxLayout" >
<item>
<layout class="QVBoxLayout" >
<item>
<widget class="QLabel" name="label_3" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Name:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>RsId:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Organisation</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_6" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Location</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_7" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Country</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" >
<item>
<widget class="QLabel" name="nameLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="idLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="orgLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="locLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="countryLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<layout class="QVBoxLayout" >
<item>
<widget class="QLabel" name="label_8" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>IP Address</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_9" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Connection Method</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_10" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Last Contact:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" >
<item>
<widget class="QLabel" name="ipLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="connLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lastLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="images.qrc" />
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,137 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* 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 <QtGui>
#include "SubFileItem.h"
#include <iostream>
#define DEBUG_ITEM 1
/** Constructor */
SubFileItem::SubFileItem(std::string hash)
:QWidget(NULL), mFileHash(hash)
{
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
connect( cancelButton, SIGNAL( clicked( void ) ), this, SLOT( cancel ( void ) ) );
connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( play ( void ) ) );
amountDone = 1;
small();
updateItemStatic();
updateItem();
}
void SubFileItem::updateItemStatic()
{
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "SubFileItem::updateItemStatic()";
std::cerr << std::endl;
#endif
QString filename = "Biggest_File.txt";
fileLabel->setText(filename);
fileLabel->setToolTip(filename);
playButton->setEnabled(false);
}
bool SubFileItem::done()
{
return (amountDone >= 100);
}
void SubFileItem::updateItem()
{
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "SubFileItem::updateItem()";
std::cerr << std::endl;
#endif
int msec_rate = 1000;
if (amountDone < 100)
{
amountDone *= 1.1;
progressBar->setValue(amountDone);
QTimer::singleShot( msec_rate, this, SLOT(updateItem( void ) ));
}
else
{
/* complete! */
progressBar->setValue(100);
playButton->setEnabled(true);
}
}
void SubFileItem::small()
{
#ifdef DEBUG_ITEM
std::cerr << "SubFileItem::cancel()";
std::cerr << std::endl;
#endif
#if 0
expandFrame->hide();
#endif
}
void SubFileItem::toggle()
{
#if 0
if (expandFrame->isHidden())
{
expandFrame->show();
}
else
{
expandFrame->hide();
}
#endif
}
void SubFileItem::cancel()
{
#ifdef DEBUG_ITEM
std::cerr << "SubFileItem::cancel()";
std::cerr << std::endl;
#endif
}
void SubFileItem::play()
{
#ifdef DEBUG_ITEM
std::cerr << "SubFileItem::play()";
std::cerr << std::endl;
#endif
}

View File

@ -0,0 +1,62 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* 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 _SUB_FILE_ITEM_DIALOG_H
#define _SUB_FILE_ITEM_DIALOG_H
#include "ui_SubFileItem.h"
#include <string>
class SubFileItem : public QWidget, private Ui::SubFileItem
{
Q_OBJECT
public:
/** Default Constructor */
SubFileItem(std::string hash);
/** Default Destructor */
void small();
bool done();
void updateItemStatic();
private slots:
/* default stuff */
void cancel();
void play();
void toggle();
void updateItem();
private:
std::string mFileHash;
/* for display purposes */
float amountDone;
};
#endif

View File

@ -0,0 +1,229 @@
<ui version="4.0" >
<class>SubFileItem</class>
<widget class="QWidget" name="SubFileItem" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>607</width>
<height>57</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<layout class="QGridLayout" >
<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>
<property name="horizontalSpacing" >
<number>0</number>
</property>
<property name="verticalSpacing" >
<number>0</number>
</property>
<item row="0" column="0" >
<widget class="QFrame" name="frame" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" >
<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>
<item>
<widget class="QLabel" name="fileLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize" >
<size>
<width>300</width>
<height>16777215</height>
</size>
</property>
<property name="font" >
<font>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>File Name</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>100</width>
<height>26</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QProgressBar" name="progressBar" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="value" >
<number>24</number>
</property>
<property name="format" >
<string>%p Kb</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cancelButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Delete FeedItem</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/close-down.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="expandButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Expand</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/textedit/zoomin.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="playButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Delete FeedItem</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/start.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="images.qrc" />
</resources>
<connections/>
</ui>

View File

@ -106,6 +106,7 @@ virtual bool forumsChanged(std::list<std::string> &forumIds) = 0;
virtual std::string createForum(std::wstring forumName, std::wstring forumDesc, uint32_t forumFlags) = 0;
virtual bool getForumInfo(std::string fId, ForumInfo &fi) = 0;
virtual bool getForumList(std::list<ForumInfo> &forumList) = 0;
virtual bool getForumThreadList(std::string fId, std::list<ThreadInfoSummary> &msgs) = 0;
virtual bool getForumThreadMsgList(std::string fId, std::string pId, std::list<ThreadInfoSummary> &msgs) = 0;

View File

@ -46,6 +46,50 @@ const uint32_t RS_POPUP_CALL = 0x0004;
const uint32_t RS_POPUP_CONNECT = 0x0008;
const uint32_t RS_FEED_TYPE_PEER = 0x0010;
const uint32_t RS_FEED_TYPE_CHAN = 0x0020;
const uint32_t RS_FEED_TYPE_FORUM = 0x0040;
const uint32_t RS_FEED_TYPE_BLOG = 0x0080;
const uint32_t RS_FEED_TYPE_CHAT = 0x0100;
const uint32_t RS_FEED_TYPE_MSG = 0x0200;
const uint32_t RS_FEED_TYPE_FILES = 0x0400;
const uint32_t RS_FEED_ITEM_PEER_CONNECT = RS_FEED_TYPE_PEER | 0x0001;
const uint32_t RS_FEED_ITEM_PEER_DISCONNECT = RS_FEED_TYPE_PEER | 0x0002;
const uint32_t RS_FEED_ITEM_PEER_NEW = RS_FEED_TYPE_PEER | 0x0003;
const uint32_t RS_FEED_ITEM_PEER_HELLO = RS_FEED_TYPE_PEER | 0x0004;
const uint32_t RS_FEED_ITEM_CHAN_NEW = RS_FEED_TYPE_CHAN | 0x0001;
const uint32_t RS_FEED_ITEM_CHAN_UPDATE = RS_FEED_TYPE_CHAN | 0x0002;
const uint32_t RS_FEED_ITEM_CHAN_MSG = RS_FEED_TYPE_CHAN | 0x0003;
const uint32_t RS_FEED_ITEM_FORUM_NEW = RS_FEED_TYPE_FORUM | 0x0001;
const uint32_t RS_FEED_ITEM_FORUM_UPDATE = RS_FEED_TYPE_FORUM | 0x0002;
const uint32_t RS_FEED_ITEM_FORUM_MSG = RS_FEED_TYPE_FORUM | 0x0003;
const uint32_t RS_FEED_ITEM_BLOG_MSG = RS_FEED_TYPE_BLOG | 0x0001;
const uint32_t RS_FEED_ITEM_CHAT_NEW = RS_FEED_TYPE_CHAT | 0x0001;
const uint32_t RS_FEED_ITEM_MESSAGE = RS_FEED_TYPE_MSG | 0x0001;
const uint32_t RS_FEED_ITEM_FILES_NEW = RS_FEED_TYPE_FILES | 0x0001;
class RsFeedItem
{
public:
RsFeedItem(uint32_t type, std::string id1, std::string id2, std::string id3)
:mType(type), mId1(id1), mId2(id2), mId3(id3)
{
return;
}
RsFeedItem() :mType(0) { return; }
uint32_t mType;
std::string mId1, mId2, mId3;
};
class RsNotify
{
public:
@ -65,6 +109,9 @@ virtual bool GetPopupMessageList(std::map<uint32_t, std::string> &list) = 0;
virtual bool SetSysMessageMode(uint32_t sysid, uint32_t mode) = 0;
virtual bool SetPopupMessageMode(uint32_t ptype, uint32_t mode) = 0;
/* Feed Output */
virtual bool GetFeedItem(RsFeedItem &item) = 0;
};