* Addition of new Feeds (PeersFeed / TransferFeed / MsgFeed)

* Addition of new FeedItems (MsgItem / ChanNewItem )
 * Removed CheckBoxes at the top of NewsFeed (should be in config)
 * Enabled subscribe/unsubscribeButtons in ChannelFeed.
 * Enabled ChanNewItem and MsgItem in NewsFeeds.
 * Remove Goto Section Button from FeedItems.
 * Disabled PlayMedia button - if no attachments.
 * Enabled Drag from Search Window (with new class SearchTreeWidget)
 * Enabled Drag from SharedFiles Dialog (mods to RemoteDirModel).
 * Enabled Drop in GeneralMsgDialog from Search/SharedFiles.
 * Updated Rs Interface (64 bits for filesize)
 * Other bits and bobs.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@635 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2008-07-04 14:41:24 +00:00
parent 56639fd1ba
commit 1f01c08de4
41 changed files with 3362 additions and 521 deletions

View file

@ -40,7 +40,7 @@ BlogMsgItem::BlogMsgItem(FeedHolder *parent, uint32_t feedId, std::string peerId
/* 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 ) ) );
//connect( gotoButton, SIGNAL( clicked( void ) ), this, SLOT( gotoHome ( void ) ) );
/* specific ones */
connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( playMedia ( void ) ) );
@ -83,7 +83,9 @@ void BlogMsgItem::updateItemStatic()
{
/* disable buttons */
clearButton->setEnabled(false);
gotoButton->setEnabled(false);
//gotoButton->setEnabled(false);
clearButton->hide();
}
}
@ -108,7 +110,10 @@ void BlogMsgItem::updateItem()
return;
}
}
playButton->setEnabled(true);
if (mFileItems.size() > 0)
{
playButton->setEnabled(true);
}
}

View file

@ -43,7 +43,7 @@
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QPushButton" name="gotoButton" >
<widget class="QPushButton" name="clearButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
<horstretch>0</horstretch>
@ -51,13 +51,13 @@
</sizepolicy>
</property>
<property name="toolTip" >
<string>Goto Section</string>
<string>Remove Item</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/add-friend24.png</iconset>
<iconset resource="images.qrc" >:/images/close_normal.png</iconset>
</property>
</widget>
</item>
@ -113,41 +113,6 @@
</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" >

View file

@ -42,7 +42,7 @@ ChanMsgItem::ChanMsgItem(FeedHolder *parent, uint32_t feedId, std::string chanId
/* 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 ) ) );
//connect( gotoButton, SIGNAL( clicked( void ) ), this, SLOT( gotoHome ( void ) ) );
/* specific ones */
connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( playMedia ( void ) ) );
@ -107,9 +107,14 @@ void ChanMsgItem::updateItemStatic()
{
/* disable buttons */
clearButton->setEnabled(false);
gotoButton->setEnabled(false);
//gotoButton->setEnabled(false);
unsubscribeButton->setEnabled(false);
clearButton->hide();
}
/* don't really want this at all! */
unsubscribeButton->hide();
}
@ -133,7 +138,10 @@ void ChanMsgItem::updateItem()
return;
}
}
playButton->setEnabled(true);
if (mFileItems.size() > 0)
{
playButton->setEnabled(true);
}
}

View file

@ -43,7 +43,7 @@
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QPushButton" name="gotoButton" >
<widget class="QPushButton" name="clearButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
<horstretch>0</horstretch>
@ -51,13 +51,13 @@
</sizepolicy>
</property>
<property name="toolTip" >
<string>Goto Section</string>
<string>Remove Item</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/add-friend24.png</iconset>
<iconset resource="images.qrc" >:/images/close_normal.png</iconset>
</property>
</widget>
</item>
@ -113,41 +113,6 @@
</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" >
@ -171,13 +136,6 @@
</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" >

View file

@ -0,0 +1,194 @@
/****************************************************************
* 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 "ChanNewItem.h"
#include "FeedHolder.h"
#include "rsiface/rschannels.h"
#include <iostream>
#define DEBUG_ITEM 1
/** Constructor */
ChanNewItem::ChanNewItem(FeedHolder *parent, uint32_t feedId, std::string chanId, bool isHome, bool isNew)
:QWidget(NULL), mParent(parent), mFeedId(feedId),
mChanId(chanId), 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( subscribeChannel ( void ) ) );
small();
updateItemStatic();
updateItem();
}
void ChanNewItem::updateItemStatic()
{
if (!rsChannels)
return;
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "ChanNewItem::updateItemStatic()";
std::cerr << std::endl;
#endif
ChannelInfo ci;
if (rsChannels->getChannelInfo(mChanId, ci))
{
nameLabel->setText(QString::fromStdWString(ci.channelName));
descLabel->setText(QString::fromStdWString(ci.channelDesc));
if (ci.channelFlags & 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 Channel");
titleLabel->setText("Channel ???");
descLabel->setText("");
}
if (mIsNew)
{
titleLabel->setText("New Channel");
}
else
{
titleLabel->setText("Updated Channel");
}
if (mIsHome)
{
/* disable buttons */
clearButton->setEnabled(false);
//gotoButton->setEnabled(false);
}
}
void ChanNewItem::updateItem()
{
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "ChanNewItem::updateItem()";
std::cerr << std::endl;
#endif
}
void ChanNewItem::small()
{
expandFrame->hide();
}
void ChanNewItem::toggle()
{
if (expandFrame->isHidden())
{
expandFrame->show();
}
else
{
expandFrame->hide();
}
}
void ChanNewItem::removeItem()
{
#ifdef DEBUG_ITEM
std::cerr << "ChanNewItem::removeItem()";
std::cerr << std::endl;
#endif
hide();
if (mParent)
{
mParent->deleteFeedItem(this, mFeedId);
}
}
void ChanNewItem::gotoHome()
{
#ifdef DEBUG_ITEM
std::cerr << "ChanNewItem::gotoHome()";
std::cerr << std::endl;
#endif
}
/*********** SPECIFIC FUNCTIOSN ***********************/
void ChanNewItem::unsubscribeChannel()
{
#ifdef DEBUG_ITEM
std::cerr << "ChanNewItem::unsubscribeChannel()";
std::cerr << std::endl;
#endif
if (rsChannels)
{
rsChannels->channelSubscribe(mChanId, false);
}
updateItemStatic();
}
void ChanNewItem::subscribeChannel()
{
#ifdef DEBUG_ITEM
std::cerr << "ChanNewItem::subscribeChannel()";
std::cerr << std::endl;
#endif
if (rsChannels)
{
rsChannels->channelSubscribe(mChanId, true);
}
updateItemStatic();
}

View file

@ -0,0 +1,67 @@
/****************************************************************
* 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_NEW_ITEM_DIALOG_H
#define _CHANNEL_NEW_ITEM_DIALOG_H
#include "ui_ChanNewItem.h"
#include <string>
class FeedHolder;
class ChanNewItem : public QWidget, private Ui::ChanNewItem
{
Q_OBJECT
public:
/** Default Constructor */
ChanNewItem(FeedHolder *parent, uint32_t feedId, std::string chanId, bool isHome, bool isNew);
/** Default Destructor */
void updateItemStatic();
void small();
private slots:
/* default stuff */
void gotoHome();
void removeItem();
void toggle();
void unsubscribeChannel();
void subscribeChannel();
void updateItem();
private:
FeedHolder *mParent;
uint32_t mFeedId;
std::string mChanId;
bool mIsHome;
bool mIsNew;
};
#endif

View file

@ -1,18 +1,24 @@
<ui version="4.0" >
<class>MsgItem</class>
<widget class="QWidget" name="MsgItem" >
<class>ChanNewItem</class>
<widget class="QWidget" name="ChanNewItem" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>603</width>
<height>358</height>
<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" >
@ -28,83 +34,24 @@
<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="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="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Remove</string>
<string>Remove Item</string>
</property>
<property name="text" >
<string/>
@ -130,8 +77,108 @@
</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 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>
<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>
@ -146,96 +193,7 @@
</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" >
<widget class="QFrame" name="expandFrame" >
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
@ -243,6 +201,21 @@
<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>
@ -251,10 +224,7 @@
<string/>
</property>
<property name="pixmap" >
<pixmap resource="images.qrc" >:/images/channels.png</pixmap>
</property>
<property name="scaledContents" >
<bool>false</bool>
<pixmap resource="images.qrc" >:/images/contacts24.png</pixmap>
</property>
</widget>
</item>
@ -268,7 +238,7 @@
</property>
<property name="text" >
<string>Description
of Channel</string>
of Forum</string>
</property>
</widget>
</item>

View file

@ -40,7 +40,7 @@ ForumMsgItem::ForumMsgItem(FeedHolder *parent, uint32_t feedId, std::string foru
/* 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 ) ) );
//connect( gotoButton, SIGNAL( clicked( void ) ), this, SLOT( gotoHome ( void ) ) );
/* specific ones */
connect( unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeForum ( void ) ) );
@ -144,8 +144,12 @@ void ForumMsgItem::updateItemStatic()
{
/* disable buttons */
clearButton->setEnabled(false);
gotoButton->setEnabled(false);
//gotoButton->setEnabled(false);
clearButton->hide();
}
unsubscribeButton->hide();
}

View file

@ -43,7 +43,7 @@
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QPushButton" name="gotoButton" >
<widget class="QPushButton" name="clearButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
@ -51,13 +51,13 @@
</sizepolicy>
</property>
<property name="toolTip" >
<string>Goto Section</string>
<string>Remove Item</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/add-friend24.png</iconset>
<iconset resource="images.qrc" >:/images/close_normal.png</iconset>
</property>
</widget>
</item>
@ -113,41 +113,6 @@
</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" >

View file

@ -40,7 +40,7 @@ ForumNewItem::ForumNewItem(FeedHolder *parent, uint32_t feedId, std::string foru
/* 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 ) ) );
//connect( gotoButton, SIGNAL( clicked( void ) ), this, SLOT( gotoHome ( void ) ) );
/* specific ones */
connect( subscribeButton, SIGNAL( clicked( void ) ), this, SLOT( subscribeForum ( void ) ) );
@ -106,7 +106,7 @@ void ForumNewItem::updateItemStatic()
{
/* disable buttons */
clearButton->setEnabled(false);
gotoButton->setEnabled(false);
//gotoButton->setEnabled(false);
}
}

View file

@ -43,7 +43,7 @@
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QPushButton" name="gotoButton" >
<widget class="QPushButton" name="clearButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
@ -51,13 +51,13 @@
</sizepolicy>
</property>
<property name="toolTip" >
<string>Goto Section</string>
<string>Remove Item</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/add-friend24.png</iconset>
<iconset resource="images.qrc" >:/images/close_normal.png</iconset>
</property>
</widget>
</item>
@ -171,41 +171,6 @@
</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" >

View file

@ -0,0 +1,260 @@
/****************************************************************
* 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 "MsgItem.h"
#include "FeedHolder.h"
#include "SubFileItem.h"
#include "rsiface/rsmsgs.h"
#include "rsiface/rspeers.h"
#include <iostream>
#define DEBUG_ITEM 1
/** Constructor */
MsgItem::MsgItem(FeedHolder *parent, uint32_t feedId, std::string msgId, bool isHome)
:QWidget(NULL), mParent(parent), mFeedId(feedId), 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( deleteButton, SIGNAL( clicked( void ) ), this, SLOT( deleteMsg ( void ) ) );
connect( replyButton, SIGNAL( clicked( void ) ), this, SLOT( replyMsg ( void ) ) );
small();
updateItemStatic();
updateItem();
}
void MsgItem::updateItemStatic()
{
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "MsgItem::updateItemStatic()";
std::cerr << std::endl;
#endif
MessageInfo mi;
if (!rsMsgs)
return;
if (!rsMsgs->getMessage(mMsgId, mi))
return;
/* get peer Id */
mPeerId = mi.srcId;
QString title;
QString timestamp;
QString srcName = QString::fromStdString(rsPeers->getPeerName(mi.srcId));
{
QDateTime qtime;
qtime.setTime_t(mi.ts);
timestamp = qtime.toString("yyyy-MM-dd hh:mm:ss");
}
if (!mIsHome)
{
title = "Message From: ";
}
else
{
/* subject */
uint32_t box = mi.msgflags & RS_MSG_BOXMASK;
switch(box)
{
case RS_MSG_SENTBOX:
title = "Sent Msg: ";
replyButton->setEnabled(false);
break;
case RS_MSG_DRAFTBOX:
title = "Draft Msg: ";
replyButton->setEnabled(false);
break;
case RS_MSG_OUTBOX:
title = "Pending Msg: ";
//deleteButton->setEnabled(false);
replyButton->setEnabled(false);
break;
default:
case RS_MSG_INBOX:
title = "";
break;
}
}
title += srcName + " @ " + timestamp;
titleLabel->setText(title);
subjectLabel->setText(QString::fromStdWString(mi.title));
msgLabel->setText(QString::fromStdWString(mi.msg));
std::list<FileInfo>::iterator it;
for(it = mi.files.begin(); it != mi.files.end(); it++)
{
/* add file */
SubFileItem *fi = new SubFileItem(it->hash, it->fname, it->size);
mFileItems.push_back(fi);
QLayout *layout = expandFrame->layout();
layout->addWidget(fi);
}
playButton->setEnabled(false);
if (mIsHome)
{
/* disable buttons */
clearButton->setEnabled(false);
//gotoButton->setEnabled(false);
/* hide buttons */
clearButton->hide();
}
else
{
//deleteButton->setEnabled(false);
}
}
void MsgItem::updateItem()
{
/* fill in */
#ifdef DEBUG_ITEM
std::cerr << "MsgItem::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;
}
}
if (mFileItems.size() > 0)
{
playButton->setEnabled(true);
}
}
void MsgItem::small()
{
expandFrame->hide();
}
void MsgItem::toggle()
{
if (expandFrame->isHidden())
{
expandFrame->show();
}
else
{
expandFrame->hide();
}
}
void MsgItem::removeItem()
{
#ifdef DEBUG_ITEM
std::cerr << "MsgItem::removeItem()";
std::cerr << std::endl;
#endif
hide();
if (mParent)
{
mParent->deleteFeedItem(this, mFeedId);
}
}
void MsgItem::gotoHome()
{
#ifdef DEBUG_ITEM
std::cerr << "MsgItem::gotoHome()";
std::cerr << std::endl;
#endif
}
/*********** SPECIFIC FUNCTIOSN ***********************/
void MsgItem::deleteMsg()
{
#ifdef DEBUG_ITEM
std::cerr << "MsgItem::deleteMsg()";
std::cerr << std::endl;
#endif
if (rsMsgs)
{
rsMsgs->MessageDelete(mMsgId);
hide(); /* will be cleaned up next refresh */
}
}
void MsgItem::replyMsg()
{
#ifdef DEBUG_ITEM
std::cerr << "MsgItem::replyMsg()";
std::cerr << std::endl;
#endif
if (mParent)
{
mParent->openMsg(FEEDHOLDER_MSG_MESSAGE, mPeerId, mMsgId);
}
}
void MsgItem::playMedia()
{
#ifdef DEBUG_ITEM
std::cerr << "MsgItem::playMedia()";
std::cerr << std::endl;
#endif
}

View file

@ -0,0 +1,72 @@
/****************************************************************
* 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 _MSG_ITEM_DIALOG_H
#define _MSG_ITEM_DIALOG_H
#include "ui_MsgItem.h"
#include <string>
class FeedHolder;
class SubFileItem;
class MsgItem : public QWidget, private Ui::MsgItem
{
Q_OBJECT
public:
/** Default Constructor */
MsgItem(FeedHolder *parent, uint32_t feedId, std::string msgId, bool isHome);
/** Default Destructor */
void updateItemStatic();
void small();
private slots:
/* default stuff */
void gotoHome();
void removeItem();
void toggle();
void playMedia();
void deleteMsg();
void replyMsg();
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,288 @@
<ui version="4.0" >
<class>MsgItem</class>
<widget class="QWidget" name="MsgItem" >
<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="clearButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Remove Item</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="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="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="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>26</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="replyButton" >
<property name="toolTip" >
<string>Reply to Message</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/mail_reply.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="deleteButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Delete Message</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

@ -41,7 +41,7 @@ PeerItem::PeerItem(FeedHolder *parent, uint32_t feedId, std::string peerId, uint
/* 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 ) ) );
//connect( gotoButton, SIGNAL( clicked( void ) ), this, SLOT( gotoHome ( void ) ) );
/* specific ones */
connect( chatButton, SIGNAL( clicked( void ) ), this, SLOT( openChat ( void ) ) );
@ -125,7 +125,10 @@ void PeerItem::updateItemStatic()
{
/* disable buttons */
clearButton->setEnabled(false);
gotoButton->setEnabled(false);
//gotoButton->setEnabled(false);
/* disable buttons */
clearButton->hide();
}
}

View file

@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>835</width>
<height>551</height>
<width>825</width>
<height>323</height>
</rect>
</property>
<property name="windowTitle" >
@ -43,7 +43,7 @@
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QPushButton" name="gotoButton" >
<widget class="QPushButton" name="clearButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
@ -51,13 +51,13 @@
</sizepolicy>
</property>
<property name="toolTip" >
<string>Goto Section</string>
<string>Remove Item</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/add-friend24.png</iconset>
<iconset resource="images.qrc" >:/images/close_normal.png</iconset>
</property>
</widget>
</item>
@ -113,41 +113,6 @@
</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" >
@ -539,12 +504,12 @@
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Preferred</enum>
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
<height>20</height>
</size>
</property>
</spacer>