mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-05 04:44:19 -04:00
Merging branches/v0.6-initdev into trunk.
These split at 6672 -> 7075, so quite a bit merge. libretroshare compiles - but untested. retroshare-gui needs GenCertDialog.ui and IdEditDialog.ui to be properly merged. (compile errors). some plugins will be broken. retroshare-nogui is untested. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7078 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
commit
c0738eec7f
407 changed files with 23716 additions and 50779 deletions
|
@ -1,189 +0,0 @@
|
|||
/****************************************************************
|
||||
* 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 <QTimer>
|
||||
|
||||
#include "BlogMsgItem.h"
|
||||
|
||||
#include "FeedHolder.h"
|
||||
#include "SubFileItem.h"
|
||||
|
||||
/****
|
||||
* #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);
|
||||
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
|
||||
/* 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("What did you expect? \nThe Blogs will be up and running shortly!");
|
||||
titleLabel->setText("Blog Feed: Jacki @ Friday");
|
||||
subjectLabel->setText("Brand new exciting Blog stuff");
|
||||
|
||||
/* add Files */
|
||||
int total = (int) (10.0 * (rand() / (RAND_MAX + 1.0)));
|
||||
int i;
|
||||
|
||||
total = 0;
|
||||
|
||||
for(i = 0; i < total; i++)
|
||||
{
|
||||
/* add file */
|
||||
SubFileItem *fi = new SubFileItem("dummyHash", "dummy_File", "", 1283918, SFI_STATE_REMOTE, mPeerId);
|
||||
mFileItems.push_back(fi);
|
||||
|
||||
QLayout *layout = expandFrame->layout();
|
||||
layout->addWidget(fi);
|
||||
}
|
||||
|
||||
playButton->setEnabled(false);
|
||||
|
||||
if (mIsHome)
|
||||
{
|
||||
/* disable buttons */
|
||||
clearButton->setEnabled(false);
|
||||
//gotoButton->setEnabled(false);
|
||||
|
||||
clearButton->hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (mFileItems.size() > 0)
|
||||
{
|
||||
playButton->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BlogMsgItem::small()
|
||||
{
|
||||
expandFrame->hide();
|
||||
}
|
||||
|
||||
void BlogMsgItem::toggle()
|
||||
{
|
||||
mParent->lockLayout(this, true);
|
||||
|
||||
if (expandFrame->isHidden())
|
||||
{
|
||||
expandFrame->show();
|
||||
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
|
||||
expandButton->setToolTip(tr("Hide"));
|
||||
}
|
||||
else
|
||||
{
|
||||
expandFrame->hide();
|
||||
expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
|
||||
expandButton->setToolTip(tr("Expand"));
|
||||
}
|
||||
|
||||
mParent->lockLayout(this, false);
|
||||
}
|
||||
|
||||
|
||||
void BlogMsgItem::removeItem()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "BlogMsgItem::removeItem()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
mParent->lockLayout(this, true);
|
||||
hide();
|
||||
mParent->lockLayout(this, false);
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
/****************************************************************
|
||||
* 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 <stdint.h>
|
||||
|
||||
class FeedHolder;
|
||||
class SubFileItem;
|
||||
|
||||
class BlogMsgItem : public QWidget, private Ui::BlogMsgItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
BlogMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &peerId, const std::string &msgId, bool isHome);
|
||||
|
||||
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
|
||||
|
|
@ -1,242 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>BlogMsgItem</class>
|
||||
<widget class="QWidget" name="BlogMsgItem">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>552</width>
|
||||
<height>238</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QFrame#frame{
|
||||
border: 2px solid #6ACEFF;
|
||||
border-radius: 10px;
|
||||
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
|
||||
stop:0 #0076B1, stop:1 #12A3EB);}</string>
|
||||
</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">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remove Item</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/close_normal.png</normaloff>:/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" stdset="0">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>26</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="titleLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="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 notr="true">Blog</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" stdset="0">
|
||||
<size>
|
||||
<width>1000</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="expandButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Expand</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.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 hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">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" stdset="0">
|
||||
<size>
|
||||
<width>500</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="playButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Play Media</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/startall.png</normaloff>:/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 hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Long
|
||||
message here</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,219 +0,0 @@
|
|||
/****************************************************************
|
||||
* 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 "BlogNewItem.h"
|
||||
#include "FeedHolder.h"
|
||||
|
||||
#include <retroshare/rsblogs.h>
|
||||
|
||||
#define BLOG_DEFAULT_IMAGE ":/images/hi64-app-kblogger.png"
|
||||
|
||||
|
||||
/****
|
||||
* #define DEBUG_ITEM 1
|
||||
****/
|
||||
|
||||
/** Constructor */
|
||||
BlogNewItem::BlogNewItem(FeedHolder *parent, uint32_t feedId, std::string blogId, bool isHome, bool isNew)
|
||||
:QWidget(NULL), mParent(parent), mFeedId(feedId),
|
||||
mBlogId(blogId), mIsHome(isHome), mIsNew(isNew)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
setupUi(this);
|
||||
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
|
||||
/* general ones */
|
||||
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
|
||||
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
|
||||
|
||||
/* specific ones */
|
||||
connect( subscribeButton, SIGNAL( clicked( void ) ), this, SLOT( subscribeBlog ( void ) ) );
|
||||
|
||||
small();
|
||||
updateItemStatic();
|
||||
updateItem();
|
||||
}
|
||||
|
||||
|
||||
void BlogNewItem::updateItemStatic()
|
||||
{
|
||||
if (!rsBlogs)
|
||||
return;
|
||||
|
||||
|
||||
/* fill in */
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "BlogNewItem::updateItemStatic()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
BlogInfo bi;
|
||||
if (rsBlogs->getBlogInfo(mBlogId, bi))
|
||||
{
|
||||
nameLabel->setText(QString::fromStdWString(bi.blogName));
|
||||
|
||||
descLabel->setText(QString::fromStdWString(bi.blogDesc));
|
||||
|
||||
if(bi.pngImageLen != 0){
|
||||
|
||||
QPixmap blogImage;
|
||||
blogImage.loadFromData(bi.pngChanImage, bi.pngImageLen, "PNG");
|
||||
logo_label->setPixmap(QPixmap(blogImage));
|
||||
}else{
|
||||
QPixmap defaulImage(BLOG_DEFAULT_IMAGE);
|
||||
logo_label->setPixmap(QPixmap(defaulImage));
|
||||
}
|
||||
|
||||
if (bi.blogFlags & 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(tr("Unknown Blog"));
|
||||
titleLabel->setText("Blog ???");
|
||||
descLabel->setText("");
|
||||
}
|
||||
|
||||
if (mIsNew)
|
||||
{
|
||||
titleLabel->setText(tr("New Blog"));
|
||||
}
|
||||
else
|
||||
{
|
||||
titleLabel->setText(tr("Updated Blog"));
|
||||
}
|
||||
|
||||
if (mIsHome)
|
||||
{
|
||||
/* disable buttons */
|
||||
clearButton->setEnabled(false);
|
||||
//gotoButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BlogNewItem::updateItem()
|
||||
{
|
||||
/* fill in */
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "BlogNewItem::updateItem()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
void BlogNewItem::small()
|
||||
{
|
||||
expandFrame->hide();
|
||||
}
|
||||
|
||||
void BlogNewItem::toggle()
|
||||
{
|
||||
mParent->lockLayout(this, true);
|
||||
|
||||
if (expandFrame->isHidden())
|
||||
{
|
||||
expandFrame->show();
|
||||
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
|
||||
expandButton->setToolTip(tr("Hide"));
|
||||
}
|
||||
else
|
||||
{
|
||||
expandFrame->hide();
|
||||
expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
|
||||
expandButton->setToolTip(tr("Expand"));
|
||||
}
|
||||
|
||||
mParent->lockLayout(this, false);
|
||||
}
|
||||
|
||||
|
||||
void BlogNewItem::removeItem()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "BlogNewItem::removeItem()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
mParent->lockLayout(this, true);
|
||||
hide();
|
||||
mParent->lockLayout(this, false);
|
||||
|
||||
if (mParent)
|
||||
{
|
||||
mParent->deleteFeedItem(this, mFeedId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BlogNewItem::gotoHome()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "BlogNewItem::gotoHome()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*********** SPECIFIC FUNCTIOSN ***********************/
|
||||
|
||||
|
||||
void BlogNewItem::unsubscribeBlog()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "BlogNewItem::unsubscribeBlog()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
if (rsBlogs)
|
||||
{
|
||||
rsBlogs->blogSubscribe(mBlogId, false);
|
||||
}
|
||||
updateItemStatic();
|
||||
}
|
||||
|
||||
|
||||
void BlogNewItem::subscribeBlog()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "BlogNewItem::subscribeBlog()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
if (rsBlogs)
|
||||
{
|
||||
rsBlogs->blogSubscribe(mBlogId, true);
|
||||
}
|
||||
updateItemStatic();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
/****************************************************************
|
||||
* 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_NEW_ITEM_DIALOG_H
|
||||
#define _BLOG_NEW_ITEM_DIALOG_H
|
||||
|
||||
#include "ui_BlogNewItem.h"
|
||||
#include <stdint.h>
|
||||
|
||||
class FeedHolder;
|
||||
|
||||
class BlogNewItem : public QWidget, private Ui::BlogNewItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
BlogNewItem(FeedHolder *parent, uint32_t feedId, const std::string &blogId, bool isHome, bool isNew);
|
||||
|
||||
void updateItemStatic();
|
||||
void small();
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
void gotoHome();
|
||||
void removeItem();
|
||||
void toggle();
|
||||
|
||||
void unsubscribeBlog();
|
||||
void subscribeBlog();
|
||||
|
||||
void updateItem();
|
||||
|
||||
private:
|
||||
FeedHolder *mParent;
|
||||
uint32_t mFeedId;
|
||||
|
||||
std::string mBlogId;
|
||||
bool mIsHome;
|
||||
bool mIsNew;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,260 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>BlogNewItem</class>
|
||||
<widget class="QWidget" name="BlogNewItem">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>643</width>
|
||||
<height>109</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QFrame#frame{
|
||||
border: 2px solid #6ACEFF;
|
||||
border-radius: 10px;
|
||||
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
|
||||
stop:0 #0076B1, stop:1 #12A3EB);}</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remove Item</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="titleLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="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 notr="true">New Blog</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" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="logo_label">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Logo</string>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="nameLabel">
|
||||
<property name="text">
|
||||
<string notr="true">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" stdset="0">
|
||||
<size>
|
||||
<width>500</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="subscribeButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Subscribe to Blog</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/directoryadd_24x24_shadow.png</normaloff>:/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" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="expandButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Expand</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.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="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Blog Description</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="iconLabel">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</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 hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Description
|
||||
of Blog</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,475 +0,0 @@
|
|||
/****************************************************************
|
||||
* 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 <QDateTime>
|
||||
#include <QTimer>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "rshare.h"
|
||||
#include "ChanMsgItem.h"
|
||||
|
||||
#include "FeedHolder.h"
|
||||
#include "SubFileItem.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "util/misc.h"
|
||||
#include "gui/RetroShareLink.h"
|
||||
#include "util/HandleRichText.h"
|
||||
#include "util/DateTime.h"
|
||||
|
||||
#include <retroshare/rschannels.h>
|
||||
|
||||
/****
|
||||
* #define DEBUG_ITEM 1
|
||||
****/
|
||||
|
||||
#define COLOR_NORMAL QColor(248, 248, 248)
|
||||
#define COLOR_NEW QColor(220, 236, 253)
|
||||
|
||||
/** Constructor */
|
||||
ChanMsgItem::ChanMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &chanId, const 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);
|
||||
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
|
||||
m_inUpdateItemStatic = false;
|
||||
|
||||
/* general ones */
|
||||
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
|
||||
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
|
||||
|
||||
/* specific */
|
||||
connect(readAndClearButton, SIGNAL(clicked()), this, SLOT(readAndClearItem()));
|
||||
connect( unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeChannel ( void ) ) );
|
||||
connect( downloadButton, SIGNAL( clicked( void ) ), this, SLOT( download ( void ) ) );
|
||||
connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( play ( void ) ) );
|
||||
connect( copyLinkButton, SIGNAL( clicked( void ) ), this, SLOT( copyLink ( void ) ) );
|
||||
|
||||
connect( readButton, SIGNAL( toggled(bool) ), this, SLOT( readToggled(bool) ) );
|
||||
connect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection);
|
||||
|
||||
downloadButton->hide();
|
||||
playButton->hide();
|
||||
warn_image_label->hide();
|
||||
warning_label->hide();
|
||||
|
||||
titleLabel->setMinimumWidth(100);
|
||||
subjectLabel->setMinimumWidth(100);
|
||||
warning_label->setMinimumWidth(100);
|
||||
|
||||
frame->setProperty("state", "");
|
||||
QPalette palette = frame->palette();
|
||||
palette.setColor(frame->backgroundRole(), COLOR_NORMAL);
|
||||
frame->setPalette(palette);
|
||||
|
||||
expandFrame->hide();
|
||||
updateItemStatic();
|
||||
updateItem();
|
||||
}
|
||||
|
||||
void ChanMsgItem::updateItemStatic()
|
||||
{
|
||||
/* fill in */
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "ChanMsgItem::updateItemStatic()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
ChannelMsgInfo cmi;
|
||||
|
||||
if (!rsChannels)
|
||||
return;
|
||||
|
||||
if (!rsChannels->getChannelMessage(mChanId, mMsgId, cmi))
|
||||
return;
|
||||
|
||||
m_inUpdateItemStatic = true;
|
||||
|
||||
QString title;
|
||||
|
||||
ChannelInfo ci;
|
||||
rsChannels->getChannelInfo(mChanId, ci);
|
||||
|
||||
if (!mIsHome)
|
||||
{
|
||||
title = tr("Channel Feed") + ": ";
|
||||
RetroShareLink link;
|
||||
link.createChannel(ci.channelId, "");
|
||||
title += link.toHtml();
|
||||
titleLabel->setText(title);
|
||||
RetroShareLink msgLink;
|
||||
msgLink.createChannel(cmi.channelId, cmi.msgId);
|
||||
subjectLabel->setText(msgLink.toHtml());
|
||||
|
||||
if ((ci.channelFlags & RS_DISTRIB_SUBSCRIBED) || (ci.channelFlags & RS_DISTRIB_ADMIN)) {
|
||||
unsubscribeButton->setEnabled(true);
|
||||
} else {
|
||||
unsubscribeButton->setEnabled(false);
|
||||
}
|
||||
readButton->hide();
|
||||
newLabel->hide();
|
||||
copyLinkButton->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* subject */
|
||||
titleLabel->setText(QString::fromStdWString(cmi.subject));
|
||||
subjectLabel->setText(RsHtml().formatText(NULL, QString::fromStdWString(cmi.msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||
|
||||
/* disable buttons: deletion facility not enabled with cache services yet */
|
||||
clearButton->setEnabled(false);
|
||||
unsubscribeButton->setEnabled(false);
|
||||
clearButton->hide();
|
||||
readAndClearButton->hide();
|
||||
unsubscribeButton->hide();
|
||||
copyLinkButton->show();
|
||||
|
||||
if ((ci.channelFlags & RS_DISTRIB_SUBSCRIBED) || (ci.channelFlags & RS_DISTRIB_ADMIN)) {
|
||||
readButton->setVisible(true);
|
||||
|
||||
uint32_t status = 0;
|
||||
rsChannels->getMessageStatus(mChanId, mMsgId, status);
|
||||
|
||||
if ((status & CHANNEL_MSG_STATUS_READ) == 0 || (status & CHANNEL_MSG_STATUS_UNREAD_BY_USER)) {
|
||||
readButton->setChecked(true);
|
||||
readButton->setIcon(QIcon(":/images/message-state-unread.png"));
|
||||
} else {
|
||||
readButton->setChecked(false);
|
||||
readButton->setIcon(QIcon(":/images/message-state-read.png"));
|
||||
}
|
||||
|
||||
bool newState;
|
||||
QColor color;
|
||||
if (status & CHANNEL_MSG_STATUS_READ) {
|
||||
newLabel->setVisible(false);
|
||||
newState = false;
|
||||
color = COLOR_NORMAL;
|
||||
} else {
|
||||
newLabel->setVisible(true);
|
||||
newState = true;
|
||||
color = COLOR_NEW;
|
||||
}
|
||||
|
||||
/* unpolish widget to clear the stylesheet's palette cache */
|
||||
frame->style()->unpolish(frame);
|
||||
|
||||
QPalette palette = frame->palette();
|
||||
palette.setColor(frame->backgroundRole(), color);
|
||||
frame->setPalette(palette);
|
||||
|
||||
frame->setProperty("new", newState);
|
||||
Rshare::refreshStyleSheet(frame, false);
|
||||
} else {
|
||||
readButton->setVisible(false);
|
||||
newLabel->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
msgLabel->setText(RsHtml().formatText(NULL, QString::fromStdWString(cmi.msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||
msgFrame->setVisible(!cmi.msg.empty());
|
||||
|
||||
datetimelabel->setText(DateTime::formatLongDateTime(cmi.ts));
|
||||
|
||||
filelabel->setText(QString("(%1 %2) %3").arg(cmi.count).arg(tr("Files")).arg(misc::friendlyUnit(cmi.size)));
|
||||
|
||||
if (mFileItems.empty() == false) {
|
||||
std::list<SubFileItem *>::iterator it;
|
||||
for(it = mFileItems.begin(); it != mFileItems.end(); it++)
|
||||
{
|
||||
delete(*it);
|
||||
}
|
||||
mFileItems.clear();
|
||||
}
|
||||
|
||||
std::list<FileInfo>::iterator it;
|
||||
for(it = cmi.files.begin(); it != cmi.files.end(); it++)
|
||||
{
|
||||
/* add file */
|
||||
SubFileItem *fi = new SubFileItem(it->hash, it->fname, it->path, it->size,
|
||||
SFI_STATE_REMOTE | SFI_TYPE_CHANNEL, "");
|
||||
fi->setChannelId(mChanId);
|
||||
mFileItems.push_back(fi);
|
||||
|
||||
/* check if the file is a media file */
|
||||
if (!misc::isPreviewable(QFileInfo(QString::fromUtf8(it->fname.c_str())).suffix()))
|
||||
{
|
||||
fi->mediatype();
|
||||
playButton->setText(tr("Open"));
|
||||
playButton->setToolTip(tr("Open File"));
|
||||
}
|
||||
else
|
||||
{
|
||||
playButton->setText(tr("Play"));
|
||||
playButton->setToolTip(tr("Play Media"));
|
||||
}
|
||||
|
||||
QLayout *layout = expandFrame->layout();
|
||||
layout->addWidget(fi);
|
||||
}
|
||||
|
||||
if(cmi.thumbnail.image_thumbnail != NULL)
|
||||
{
|
||||
QPixmap thumbnail;
|
||||
thumbnail.loadFromData(cmi.thumbnail.image_thumbnail, cmi.thumbnail.im_thumbnail_size, "PNG");
|
||||
|
||||
logoLabel->setPixmap(thumbnail);
|
||||
}
|
||||
|
||||
m_inUpdateItemStatic = false;
|
||||
}
|
||||
|
||||
void ChanMsgItem::setFileCleanUpWarning(uint32_t time_left)
|
||||
{
|
||||
int hours = (int)time_left/3600;
|
||||
int minutes = (time_left - hours*3600)%60;
|
||||
|
||||
warning_label->setText(tr("Warning! You have less than %1 hours and %2 minute before this file is deleted Consider saving it.").arg(
|
||||
QString::number(hours)).arg(QString::number(minutes)));
|
||||
|
||||
QFont warnFont = warning_label->font();
|
||||
warnFont.setBold(true);
|
||||
warning_label->setFont(warnFont);
|
||||
|
||||
warn_image_label->setVisible(true);
|
||||
warning_label->setVisible(true);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
void ChanMsgItem::updateItem()
|
||||
{
|
||||
/* fill in */
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "ChanMsgItem::updateItem()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
int msec_rate = 10000;
|
||||
|
||||
int downloadCount = 0;
|
||||
int downloadStartable = 0;
|
||||
int playCount = 0;
|
||||
int playStartable = 0;
|
||||
bool startable;
|
||||
bool loopAgain = false;
|
||||
|
||||
/* Very slow Tick to check when all files are downloaded */
|
||||
std::list<SubFileItem *>::iterator it;
|
||||
for(it = mFileItems.begin(); it != mFileItems.end(); it++)
|
||||
{
|
||||
SubFileItem *item = *it;
|
||||
|
||||
if (item->isDownloadable(startable)) {
|
||||
downloadCount++;
|
||||
if (startable) {
|
||||
downloadStartable++;
|
||||
}
|
||||
}
|
||||
if (item->isPlayable(startable)) {
|
||||
playCount++;
|
||||
if (startable) {
|
||||
playStartable++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!item->done())
|
||||
{
|
||||
/* loop again */
|
||||
loopAgain = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (downloadCount) {
|
||||
downloadButton->show();
|
||||
|
||||
if (downloadStartable) {
|
||||
downloadButton->setEnabled(true);
|
||||
} else {
|
||||
downloadButton->setEnabled(false);
|
||||
}
|
||||
} else {
|
||||
downloadButton->hide();
|
||||
}
|
||||
if (playCount) {
|
||||
/* one file is playable */
|
||||
playButton->show();
|
||||
|
||||
if (playStartable == 1) {
|
||||
playButton->setEnabled(true);
|
||||
} else {
|
||||
playButton->setEnabled(false);
|
||||
}
|
||||
} else {
|
||||
playButton->hide();
|
||||
}
|
||||
|
||||
if (loopAgain) {
|
||||
QTimer::singleShot( msec_rate, this, SLOT(updateItem( void ) ));
|
||||
}
|
||||
}
|
||||
|
||||
void ChanMsgItem::toggle()
|
||||
{
|
||||
mParent->lockLayout(this, true);
|
||||
|
||||
if (expandFrame->isHidden())
|
||||
{
|
||||
expandFrame->show();
|
||||
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
|
||||
expandButton->setToolTip(tr("Hide"));
|
||||
|
||||
readToggled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
expandFrame->hide();
|
||||
expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
|
||||
expandButton->setToolTip(tr("Expand"));
|
||||
}
|
||||
|
||||
mParent->lockLayout(this, false);
|
||||
}
|
||||
|
||||
void ChanMsgItem::removeItem()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "ChanMsgItem::removeItem()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
mParent->lockLayout(this, true);
|
||||
hide();
|
||||
mParent->lockLayout(this, false);
|
||||
|
||||
if (mParent)
|
||||
{
|
||||
mParent->deleteFeedItem(this, mFeedId);
|
||||
}
|
||||
}
|
||||
|
||||
/*********** SPECIFIC FUNCTIONS ***********************/
|
||||
|
||||
void ChanMsgItem::readAndClearItem()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "ChanMsgItem::readAndClearItem()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
readToggled(false);
|
||||
removeItem();
|
||||
}
|
||||
|
||||
void ChanMsgItem::unsubscribeChannel()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "ChanMsgItem::unsubscribeChannel()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
if (rsChannels)
|
||||
{
|
||||
rsChannels->channelSubscribe(mChanId, false, false);
|
||||
}
|
||||
updateItemStatic();
|
||||
}
|
||||
|
||||
void ChanMsgItem::download()
|
||||
{
|
||||
readToggled(false);
|
||||
|
||||
std::list<SubFileItem *>::iterator it;
|
||||
for(it = mFileItems.begin(); it != mFileItems.end(); it++)
|
||||
{
|
||||
(*it)->download();
|
||||
}
|
||||
|
||||
updateItem();
|
||||
}
|
||||
|
||||
void ChanMsgItem::play()
|
||||
{
|
||||
std::list<SubFileItem *>::iterator it;
|
||||
for(it = mFileItems.begin(); it != mFileItems.end(); it++)
|
||||
{
|
||||
bool startable;
|
||||
if ((*it)->isPlayable(startable) && startable) {
|
||||
(*it)->play();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ChanMsgItem::readToggled(bool checked)
|
||||
{
|
||||
if (m_inUpdateItemStatic) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* set always as read ... */
|
||||
uint32_t statusNew = CHANNEL_MSG_STATUS_READ;
|
||||
if (checked) {
|
||||
/* ... and as unread by user */
|
||||
statusNew |= CHANNEL_MSG_STATUS_UNREAD_BY_USER;
|
||||
} else {
|
||||
/* ... and as read by user */
|
||||
statusNew &= ~CHANNEL_MSG_STATUS_UNREAD_BY_USER;
|
||||
}
|
||||
|
||||
if (!mIsHome) {
|
||||
disconnect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)));
|
||||
}
|
||||
rsChannels->setMessageStatus(mChanId, mMsgId, statusNew, CHANNEL_MSG_STATUS_READ | CHANNEL_MSG_STATUS_UNREAD_BY_USER);
|
||||
if (!mIsHome) {
|
||||
connect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
|
||||
void ChanMsgItem::channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status)
|
||||
{
|
||||
if (channelId.toStdString() == mChanId && msgId.toStdString() == mMsgId) {
|
||||
if (!mIsHome) {
|
||||
if (status & CHANNEL_MSG_STATUS_READ) {
|
||||
close();
|
||||
return;
|
||||
}
|
||||
}
|
||||
updateItemStatic();
|
||||
}
|
||||
}
|
||||
|
||||
void ChanMsgItem::copyLink()
|
||||
{
|
||||
if (mChanId.empty() || mMsgId.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ChannelMsgInfo cmi;
|
||||
if (rsChannels->getChannelMessage(mChanId, mMsgId, cmi)) {
|
||||
RetroShareLink link;
|
||||
if (link.createChannel(cmi.channelId, cmi.msgId)) {
|
||||
QList<RetroShareLink> urls;
|
||||
urls.push_back(link);
|
||||
RSLinkClipboard::copyLinks(urls);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
/****************************************************************
|
||||
* 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 <stdint.h>
|
||||
|
||||
class FeedHolder;
|
||||
class SubFileItem;
|
||||
|
||||
class ChanMsgItem : public QWidget, private Ui::ChanMsgItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
ChanMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &chanId, const std::string &msgId, bool isHome);
|
||||
|
||||
void updateItemStatic();
|
||||
void setFileCleanUpWarning(uint32_t time_left);
|
||||
|
||||
const std::string &msgId() { return mMsgId; }
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
void removeItem();
|
||||
void toggle();
|
||||
|
||||
void readAndClearItem();
|
||||
void unsubscribeChannel();
|
||||
void download();
|
||||
void play();
|
||||
void copyLink();
|
||||
|
||||
void readToggled(bool checked);
|
||||
void channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status);
|
||||
|
||||
void updateItem();
|
||||
|
||||
private:
|
||||
FeedHolder *mParent;
|
||||
uint32_t mFeedId;
|
||||
|
||||
std::string mChanId;
|
||||
std::string mMsgId;
|
||||
|
||||
bool mIsHome;
|
||||
bool m_inUpdateItemStatic;
|
||||
|
||||
std::list<SubFileItem *> mFileItems;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,496 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ChanMsgItem</class>
|
||||
<widget class="QWidget" name="ChanMsgItem">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>629</width>
|
||||
<height>175</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<property name="horizontalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QLabel" name="logoLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>158</width>
|
||||
<height>108</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>158</width>
|
||||
<height>108</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/thumb-default-video.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="titleLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
<weight>75</weight>
|
||||
<italic>true</italic>
|
||||
<bold>true</bold>
|
||||
<stylestrategy>PreferAntialias</stylestrategy>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:11pt; font-weight:600; font-style:italic;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:normal; color:#656565;">Channel Subject</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="datetimelabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<stylestrategy>PreferAntialias</stylestrategy>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:600; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; color:#666666;">DateTime</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="subjectLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; color:#666666;">Short Description</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="filelabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<stylestrategy>PreferAntialias</stylestrategy>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">fileLabel</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="warn_image_label">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/status_unknown.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="warning_label">
|
||||
<property name="text">
|
||||
<string notr="true">TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="readButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Toggle Message Read Status</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/message-state-unread.png</normaloff>:/images/message-state-unread.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="newLabel">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="downloadButton">
|
||||
<property name="font">
|
||||
<font/>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Download</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/download16.png</normaloff>:/images/download16.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="playButton">
|
||||
<property name="font">
|
||||
<font/>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Play</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/player_play.png</normaloff>:/images/player_play.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="copyLinkButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Copy RetroShare Link</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/copyrslink.png</normaloff>:/images/copyrslink.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="unsubscribeButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Unsubscribe From Channel</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/mail_delete.png</normaloff>:/images/mail_delete.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="expandButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Expand</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="readAndClearButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Set as read and remove item</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/cancel.png</normaloff>:/images/cancel.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remove Item</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="expandFrame">
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFrame" name="msgFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="msgLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,205 +0,0 @@
|
|||
/****************************************************************
|
||||
* 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 "ChanNewItem.h"
|
||||
#include "FeedHolder.h"
|
||||
#include "gui/RetroShareLink.h"
|
||||
|
||||
#include <retroshare/rschannels.h>
|
||||
|
||||
#define CHAN_DEFAULT_IMAGE ":/images/channels.png"
|
||||
|
||||
/****
|
||||
* #define DEBUG_ITEM 1
|
||||
****/
|
||||
|
||||
/** Constructor */
|
||||
ChanNewItem::ChanNewItem(FeedHolder *parent, uint32_t feedId, const 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);
|
||||
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
|
||||
/* general ones */
|
||||
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
|
||||
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
|
||||
|
||||
/* specific ones */
|
||||
connect( subscribeButton, SIGNAL( clicked( void ) ), this, SLOT( subscribeChannel ( void ) ) );
|
||||
|
||||
expandFrame->hide();
|
||||
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))
|
||||
{
|
||||
RetroShareLink link;
|
||||
link.createChannel(ci.channelId, "");
|
||||
nameLabel->setText(link.toHtml());
|
||||
|
||||
descLabel->setText(QString::fromStdWString(ci.channelDesc));
|
||||
|
||||
if(ci.pngImageLen != 0){
|
||||
QPixmap chanImage;
|
||||
chanImage.loadFromData(ci.pngChanImage, ci.pngImageLen, "PNG");
|
||||
logoLabel->setPixmap(QPixmap(chanImage));
|
||||
} else {
|
||||
QPixmap defaulImage(CHAN_DEFAULT_IMAGE);
|
||||
logoLabel->setPixmap(QPixmap(defaulImage));
|
||||
}
|
||||
|
||||
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(tr("Unknown Channel"));
|
||||
titleLabel->setText("Channel ???");
|
||||
descLabel->setText("");
|
||||
}
|
||||
|
||||
if (mIsNew)
|
||||
{
|
||||
titleLabel->setText(tr("New Channel"));
|
||||
}
|
||||
else
|
||||
{
|
||||
titleLabel->setText(tr("Updated Channel"));
|
||||
}
|
||||
|
||||
if (mIsHome)
|
||||
{
|
||||
/* disable buttons */
|
||||
clearButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ChanNewItem::updateItem()
|
||||
{
|
||||
/* fill in */
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "ChanNewItem::updateItem()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void ChanNewItem::toggle()
|
||||
{
|
||||
mParent->lockLayout(this, true);
|
||||
|
||||
if (expandFrame->isHidden())
|
||||
{
|
||||
expandFrame->show();
|
||||
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
|
||||
expandButton->setToolTip(tr("Hide"));
|
||||
}
|
||||
else
|
||||
{
|
||||
expandFrame->hide();
|
||||
expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
|
||||
expandButton->setToolTip(tr("Expand"));
|
||||
}
|
||||
|
||||
mParent->lockLayout(this, false);
|
||||
}
|
||||
|
||||
|
||||
void ChanNewItem::removeItem()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "ChanNewItem::removeItem()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
mParent->lockLayout(this, true);
|
||||
hide();
|
||||
mParent->lockLayout(this, false);
|
||||
|
||||
if (mParent)
|
||||
{
|
||||
mParent->deleteFeedItem(this, mFeedId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*********** SPECIFIC FUNCTIOSN ***********************/
|
||||
|
||||
|
||||
void ChanNewItem::unsubscribeChannel()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "ChanNewItem::unsubscribeChannel()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
if (rsChannels)
|
||||
{
|
||||
rsChannels->channelSubscribe(mChanId, false, false);
|
||||
}
|
||||
updateItemStatic();
|
||||
}
|
||||
|
||||
|
||||
void ChanNewItem::subscribeChannel()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "ChanNewItem::subscribeChannel()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
if (rsChannels)
|
||||
{
|
||||
rsChannels->channelSubscribe(mChanId, true, true);
|
||||
}
|
||||
updateItemStatic();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
/****************************************************************
|
||||
* 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 <stdint.h>
|
||||
|
||||
class FeedHolder;
|
||||
|
||||
class ChanNewItem : public QWidget, private Ui::ChanNewItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
ChanNewItem(FeedHolder *parent, uint32_t feedId, const std::string &chanId, bool isHome, bool isNew);
|
||||
|
||||
void updateItemStatic();
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
void removeItem();
|
||||
void toggle();
|
||||
|
||||
void unsubscribeChannel();
|
||||
void subscribeChannel();
|
||||
|
||||
void updateItem();
|
||||
|
||||
private:
|
||||
FeedHolder *mParent;
|
||||
uint32_t mFeedId;
|
||||
|
||||
std::string mChanId;
|
||||
bool mIsHome;
|
||||
bool mIsNew;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,284 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ChanNewItem</class>
|
||||
<widget class="QWidget" name="ChanNewItem">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>643</width>
|
||||
<height>157</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>248</red>
|
||||
<green>248</green>
|
||||
<blue>248</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>248</red>
|
||||
<green>248</green>
|
||||
<blue>248</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>248</red>
|
||||
<green>248</green>
|
||||
<blue>248</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="logoLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>70</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>70</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="nameLabel">
|
||||
<property name="text">
|
||||
<string notr="true">name</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="titleLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="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 notr="true">New Channel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>338</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="subscribeButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Subscribe to Channel</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/directoryadd_24x24_shadow.png</normaloff>:/images/directoryadd_24x24_shadow.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="expandButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Expand</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remove Item</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>455</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QFrame" name="expandFrame">
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Channel Description</string>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<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 row="0" column="1">
|
||||
<widget class="QLabel" name="descLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Description
|
||||
of Channel</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -243,8 +243,8 @@ void ChatMsgItem::sendMessage()
|
|||
/* construct a message */
|
||||
MessageInfo mi;
|
||||
|
||||
mi.title = tr("Quick Message").toStdWString();
|
||||
mi.msg = quickmsgText->toHtml().toStdWString();
|
||||
mi.title = tr("Quick Message").toUtf8().constData();
|
||||
mi.msg = quickmsgText->toHtml().toUtf8().constData();
|
||||
mi.msgto.push_back(mPeerId);
|
||||
|
||||
rsMsgs->MessageSend(mi);
|
||||
|
|
|
@ -1,442 +0,0 @@
|
|||
/****************************************************************
|
||||
* 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 <QDateTime>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "ForumMsgItem.h"
|
||||
#include "FeedHolder.h"
|
||||
#include "gui/RetroShareLink.h"
|
||||
|
||||
#include <retroshare/rsforums.h>
|
||||
#include <retroshare/rsmsgs.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
|
||||
#include "gui/forums/CreateForumMsg.h"
|
||||
#include "util/HandleRichText.h"
|
||||
#include "util/DateTime.h"
|
||||
#include "gui/common/AvatarDefs.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/ForumsDialog.h"
|
||||
//#include "gui/settings/rsharesettings.h"
|
||||
|
||||
/****
|
||||
* #define DEBUG_ITEM 1
|
||||
****/
|
||||
|
||||
/** Constructor */
|
||||
ForumMsgItem::ForumMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &forumId, const 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);
|
||||
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
|
||||
/* general ones */
|
||||
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
|
||||
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
|
||||
|
||||
/* specific ones */
|
||||
connect(readAndClearButton, SIGNAL(clicked()), this, SLOT(readAndClearItem()));
|
||||
connect( unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeForum ( void ) ) );
|
||||
connect( replyButton, SIGNAL( clicked( void ) ), this, SLOT( replyToPost ( void ) ) );
|
||||
connect( sendButton, SIGNAL( clicked( ) ), this, SLOT( sendMsg() ) );
|
||||
|
||||
connect(NotifyQt::getInstance(), SIGNAL(forumMsgReadSatusChanged(QString,QString,int)), this, SLOT(forumMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection);
|
||||
|
||||
subjectLabel->setMinimumWidth(20);
|
||||
|
||||
nextFrame->hide();
|
||||
prevFrame->hide();
|
||||
|
||||
updateItemStatic();
|
||||
updateItem();
|
||||
textEdit->hide();
|
||||
sendButton->hide();
|
||||
signedcheckBox->hide();
|
||||
}
|
||||
|
||||
void ForumMsgItem::updateItemStatic()
|
||||
{
|
||||
if (!rsForums)
|
||||
return;
|
||||
|
||||
/* fill in */
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "ForumMsgItem::updateItemStatic()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
canReply = false;
|
||||
|
||||
ForumInfo fi;
|
||||
if (rsForums->getForumInfo(mForumId, fi))
|
||||
{
|
||||
RetroShareLink link;
|
||||
link.createForum(fi.forumId, "");
|
||||
QString title = tr("Forum Post") + ": ";
|
||||
title += link.toHtml();
|
||||
|
||||
titleLabel->setText(title);
|
||||
if (fi.subscribeFlags & (RS_DISTRIB_ADMIN | RS_DISTRIB_SUBSCRIBED))
|
||||
{
|
||||
unsubscribeButton->setEnabled(true);
|
||||
replyButton->setEnabled(true);
|
||||
|
||||
if (fi.forumFlags & RS_DISTRIB_AUTHEN_REQ)
|
||||
{
|
||||
signedcheckBox->setChecked(true);
|
||||
signedcheckBox->setEnabled(false);
|
||||
}
|
||||
|
||||
canReply = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsubscribeButton->setEnabled(false);
|
||||
replyButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
titleLabel->setText(tr("Unknown Forum Post"));
|
||||
}
|
||||
|
||||
if (fi.forumFlags & RS_DISTRIB_AUTHEN_REQ) {
|
||||
iconLabel->setPixmap(QPixmap(":/images/konv_message64.png"));
|
||||
} else {
|
||||
iconLabel->setPixmap(QPixmap(":/images/konversation64.png"));
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
RetroShareLink link;
|
||||
link.createForum(msg.forumId, msg.msgId);
|
||||
|
||||
if (mIsTop)
|
||||
{
|
||||
avatar->setId(msg.srcId, true);
|
||||
|
||||
if (rsPeers->getPeerName(msg.srcId) !="")
|
||||
{
|
||||
RetroShareLink linkMessage;
|
||||
linkMessage.createMessage(msg.srcId, "");
|
||||
nameLabel->setText(linkMessage.toHtml());
|
||||
}
|
||||
else
|
||||
{
|
||||
nameLabel->setText(tr("Anonymous"));
|
||||
}
|
||||
|
||||
prevSubLabel->setText(link.toHtml());
|
||||
prevMsgLabel->setText(RsHtml().formatText(NULL, ForumsDialog::messageFromInfo(msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||
|
||||
timestamplabel->setText(DateTime::formatLongDateTime(msg.ts));
|
||||
|
||||
nextFrame->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
nextAvatar->setId(msg.srcId, true);
|
||||
|
||||
if (rsPeers->getPeerName(msg.srcId) !="")
|
||||
{
|
||||
RetroShareLink linkMessage;
|
||||
linkMessage.createMessage(msg.srcId, "");
|
||||
nextNameLabel->setText(linkMessage.toHtml());
|
||||
}
|
||||
else
|
||||
{
|
||||
nextNameLabel->setText(tr("Anonymous"));
|
||||
}
|
||||
|
||||
nextSubLabel->setText(link.toHtml());
|
||||
nextMsgLabel->setText(RsHtml().formatText(NULL, ForumsDialog::messageFromInfo(msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||
|
||||
timestamplabel->setText(DateTime::formatLongDateTime(msg.ts));
|
||||
|
||||
prevSHLabel->setText(tr("In Reply to") + ": ");
|
||||
|
||||
ForumMsgInfo msgParent;
|
||||
if (rsForums->getForumMessage(mForumId, msg.parentId, msgParent))
|
||||
{
|
||||
avatar->setId(msgParent.srcId, true);
|
||||
|
||||
RetroShareLink linkParent;
|
||||
linkParent.createForum(msgParent.forumId, msgParent.msgId);
|
||||
prevSubLabel->setText(linkParent.toHtml());
|
||||
prevMsgLabel->setText(RsHtml().formatText(NULL, ForumsDialog::messageFromInfo(msgParent), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||
|
||||
if (rsPeers->getPeerName(msgParent.srcId) !="")
|
||||
{
|
||||
RetroShareLink linkMessage;
|
||||
linkMessage.createMessage(msgParent.srcId, "");
|
||||
nameLabel->setText(linkMessage.toHtml());
|
||||
}
|
||||
else
|
||||
{
|
||||
nameLabel->setText(tr("Anonymous"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
prevSubLabel->setText("???");
|
||||
prevMsgLabel->setText("???");
|
||||
}
|
||||
}
|
||||
|
||||
/* header stuff */
|
||||
subjectLabel->setText(link.toHtml());
|
||||
//srcLabel->setText(QString::fromStdString(msg.srcId));
|
||||
}
|
||||
|
||||
if (mIsHome)
|
||||
{
|
||||
/* disable buttons */
|
||||
clearButton->setEnabled(false);
|
||||
//gotoButton->setEnabled(false);
|
||||
|
||||
clearButton->hide();
|
||||
}
|
||||
|
||||
unsubscribeButton->hide();
|
||||
}
|
||||
|
||||
void ForumMsgItem::updateItem()
|
||||
{
|
||||
/* fill in */
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "ForumMsgItem::updateItem()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void ForumMsgItem::toggle()
|
||||
{
|
||||
mParent->lockLayout(this, true);
|
||||
|
||||
if (prevFrame->isHidden())
|
||||
{
|
||||
prevFrame->show();
|
||||
textEdit->setVisible(canReply);
|
||||
sendButton->setVisible(canReply);
|
||||
signedcheckBox->setVisible(canReply);
|
||||
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
|
||||
expandButton->setToolTip(tr("Hide"));
|
||||
if (!mIsTop)
|
||||
{
|
||||
nextFrame->show();
|
||||
}
|
||||
|
||||
setAsRead();
|
||||
}
|
||||
else
|
||||
{
|
||||
prevFrame->hide();
|
||||
nextFrame->hide();
|
||||
textEdit->hide();
|
||||
sendButton->hide();
|
||||
signedcheckBox->hide();
|
||||
expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
|
||||
expandButton->setToolTip(tr("Expand"));
|
||||
}
|
||||
|
||||
mParent->lockLayout(this, false);
|
||||
}
|
||||
|
||||
void ForumMsgItem::removeItem()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "ForumMsgItem::removeItem()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
mParent->lockLayout(this, true);
|
||||
hide();
|
||||
mParent->lockLayout(this, false);
|
||||
|
||||
if (mParent)
|
||||
{
|
||||
mParent->deleteFeedItem(this, mFeedId);
|
||||
}
|
||||
}
|
||||
|
||||
/*********** SPECIFIC FUNCTIOSN ***********************/
|
||||
|
||||
void ForumMsgItem::readAndClearItem()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "ForumMsgItem::readAndClearItem()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
setAsRead();
|
||||
removeItem();
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
if (canReply == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "ForumMsgItem::replyToPost()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
if (mParent)
|
||||
{
|
||||
CreateForumMsg *cfm = new CreateForumMsg(mForumId, mPostId);
|
||||
cfm->show();
|
||||
}
|
||||
}
|
||||
|
||||
void ForumMsgItem::sendMsg()
|
||||
{
|
||||
if (canReply == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(textEdit->toPlainText().isEmpty())
|
||||
{ /* error message */
|
||||
QMessageBox::warning(this, "RetroShare",tr("Please give a Text Message"),
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
|
||||
return; //Don't add a empty Message!!
|
||||
}
|
||||
|
||||
ForumMsgInfo msg;
|
||||
|
||||
/* get message */
|
||||
if (rsForums->getForumMessage(mForumId, mPostId, msg)) {
|
||||
ForumMsgInfo msgInfo;
|
||||
|
||||
msgInfo.forumId = mForumId;
|
||||
msgInfo.threadId = "";
|
||||
msgInfo.parentId = mPostId;
|
||||
msgInfo.msgId = "";
|
||||
|
||||
/* modify title */
|
||||
QString text = QString::fromStdWString(msg.title);
|
||||
if (text.startsWith("Re:", Qt::CaseInsensitive)) {
|
||||
msgInfo.title = msg.title;
|
||||
} else {
|
||||
msgInfo.title = L"Re: " + msg.title;
|
||||
}
|
||||
|
||||
QString desc;
|
||||
RsHtml::optimizeHtml(textEdit, desc);
|
||||
|
||||
msgInfo.msg = desc.toStdWString();
|
||||
msgInfo.msgflags = 0;
|
||||
|
||||
if (signedcheckBox->isChecked())
|
||||
{
|
||||
msgInfo.msgflags = RS_DISTRIB_AUTHEN_REQ;
|
||||
}
|
||||
|
||||
if ((msgInfo.msg == L"") && (msgInfo.title == L""))
|
||||
return; /* do nothing */
|
||||
|
||||
if (rsForums->ForumMessageSend(msgInfo) == true) {
|
||||
textEdit->clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ForumMsgItem::forumMsgReadSatusChanged(const QString &forumId, const QString &msgId, int status)
|
||||
{
|
||||
if (mForumId == forumId.toStdString() && mPostId == msgId.toStdString()) {
|
||||
if (status & FORUM_MSG_STATUS_READ) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ForumMsgItem::setAsRead()
|
||||
{
|
||||
if (canReply) {
|
||||
uint32_t status;
|
||||
rsForums->getMessageStatus(mForumId, mPostId, status);
|
||||
|
||||
/* set always to read ... */
|
||||
uint32_t statusNew = status | FORUM_MSG_STATUS_READ;
|
||||
|
||||
// bool setToReadOnActive = Settings->getForumMsgSetToReadOnActivate();
|
||||
// if (setToReadOnActive) {
|
||||
/* ... and to read by user */
|
||||
statusNew &= ~FORUM_MSG_STATUS_UNREAD_BY_USER;
|
||||
// } else {
|
||||
// /* ... and to unread by user */
|
||||
// statusNew |= FORUM_MSG_STATUS_UNREAD_BY_USER;
|
||||
// }
|
||||
|
||||
if (status != statusNew) {
|
||||
disconnect(NotifyQt::getInstance(), SIGNAL(forumMsgReadSatusChanged(QString,QString,int)), this, SLOT(forumMsgReadSatusChanged(QString,QString,int)));
|
||||
rsForums->setMessageStatus(mForumId, mPostId, statusNew, FORUM_MSG_STATUS_READ | FORUM_MSG_STATUS_UNREAD_BY_USER);
|
||||
connect(NotifyQt::getInstance(), SIGNAL(forumMsgReadSatusChanged(QString,QString,int)), this, SLOT(forumMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
/****************************************************************
|
||||
* 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 <stdint.h>
|
||||
class ForumMsgItem : public QWidget, private Ui::ForumMsgItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
ForumMsgItem(FeedHolder *parent, uint32_t feedId, const std::string &forumId, const std::string &postId, bool isHome);
|
||||
|
||||
void updateItemStatic();
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
void removeItem();
|
||||
void toggle();
|
||||
|
||||
void readAndClearItem();
|
||||
void unsubscribeForum();
|
||||
void subscribeForum();
|
||||
void replyToPost();
|
||||
void sendMsg();
|
||||
|
||||
void forumMsgReadSatusChanged(const QString &forumId, const QString &msgId, int status);
|
||||
|
||||
void updateItem();
|
||||
|
||||
private:
|
||||
void setAsRead();
|
||||
|
||||
FeedHolder *mParent;
|
||||
uint32_t mFeedId;
|
||||
bool canReply;
|
||||
|
||||
std::string mForumId;
|
||||
std::string mPostId;
|
||||
bool mIsHome;
|
||||
bool mIsTop;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,664 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ForumMsgItem</class>
|
||||
<widget class="QWidget" name="ForumMsgItem">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>577</width>
|
||||
<height>387</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="2" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>215</red>
|
||||
<green>215</green>
|
||||
<blue>215</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>215</red>
|
||||
<green>215</green>
|
||||
<blue>215</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>215</red>
|
||||
<green>215</green>
|
||||
<blue>215</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="iconLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>70</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>70</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/konversation64.png</pixmap>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="titleLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
<weight>75</weight>
|
||||
<italic>false</italic>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Forum Name</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>358</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QLabel" name="timestamplabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Timestamp</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="4">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>518</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<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 notr="true">Subject...</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="unsubscribeButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Unsubscribe To Forum</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/mail_delete.png</normaloff>:/images/mail_delete.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="replyButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reply</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/replymail24.png</normaloff>:/images/replymail24.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="expandButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Expand</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="readAndClearButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Set as read and remove item</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/cancel.png</normaloff>:/images/cancel.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remove Item</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QFrame" name="prevFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="AvatarWidget" name="avatar">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="nameLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Friend Name</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" rowspan="2">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="prevSHLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<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 hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Message is about ???</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" rowspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>9</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="prevMsgLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Previous Message...</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QFrame" name="nextFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0" rowspan="3">
|
||||
<widget class="AvatarWidget" name="nextAvatar">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="nextNameLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Next Name</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<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 hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Message is about ???</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>27</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="2" rowspan="2">
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="nextMsgLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Current Message..</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QTextEdit" name="textEdit">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>2</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="sendButton">
|
||||
<property name="text">
|
||||
<string>Send</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="signedcheckBox">
|
||||
<property name="text">
|
||||
<string>Signed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>AvatarWidget</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>gui/common/AvatarWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,212 +0,0 @@
|
|||
/****************************************************************
|
||||
* 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 "ForumNewItem.h"
|
||||
#include "FeedHolder.h"
|
||||
|
||||
#include <retroshare/rsforums.h>
|
||||
#include "gui/forums/CreateForumMsg.h"
|
||||
#include "gui/RetroShareLink.h"
|
||||
|
||||
/****
|
||||
* #define DEBUG_ITEM 1
|
||||
****/
|
||||
|
||||
/** Constructor */
|
||||
ForumNewItem::ForumNewItem(FeedHolder *parent, uint32_t feedId, const 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);
|
||||
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
|
||||
/* general ones */
|
||||
connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
|
||||
connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( 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 ) ) );
|
||||
|
||||
expandFrame->hide();
|
||||
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))
|
||||
{
|
||||
RetroShareLink link;
|
||||
link.createForum(fi.forumId, "");
|
||||
nameLabel->setText(link.toHtml());
|
||||
|
||||
descLabel->setText(QString::fromStdWString(fi.forumDesc));
|
||||
|
||||
if (fi.subscribeFlags & RS_DISTRIB_SUBSCRIBED)
|
||||
{
|
||||
subscribeButton->setEnabled(false);
|
||||
postButton->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
subscribeButton->setEnabled(true);
|
||||
postButton->setEnabled(false);
|
||||
}
|
||||
|
||||
if (fi.forumFlags & RS_DISTRIB_AUTHEN_REQ) {
|
||||
forumlogo_label->setPixmap(QPixmap(":/images/konv_message64.png"));
|
||||
} else {
|
||||
forumlogo_label->setPixmap(QPixmap(":/images/konversation64.png"));
|
||||
}
|
||||
|
||||
/* should also check the other flags */
|
||||
}
|
||||
else
|
||||
{
|
||||
nameLabel->setText(tr("Unknown Forum"));
|
||||
titleLabel->setText(tr("New Forum"));
|
||||
descLabel->setText("");
|
||||
}
|
||||
|
||||
if (mIsNew)
|
||||
{
|
||||
titleLabel->setText(tr("New Forum"));
|
||||
}
|
||||
else
|
||||
{
|
||||
titleLabel->setText(tr("Updated Forum"));
|
||||
}
|
||||
|
||||
if (mIsHome)
|
||||
{
|
||||
/* disable buttons */
|
||||
clearButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ForumNewItem::updateItem()
|
||||
{
|
||||
/* fill in */
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "ForumNewItem::updateItem()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void ForumNewItem::toggle()
|
||||
{
|
||||
mParent->lockLayout(this, true);
|
||||
|
||||
if (expandFrame->isHidden())
|
||||
{
|
||||
expandFrame->show();
|
||||
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
|
||||
expandButton->setToolTip(tr("Hide"));
|
||||
}
|
||||
else
|
||||
{
|
||||
expandFrame->hide();
|
||||
expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
|
||||
expandButton->setToolTip(tr("Expand"));
|
||||
}
|
||||
|
||||
mParent->lockLayout(this, false);
|
||||
}
|
||||
|
||||
void ForumNewItem::removeItem()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "ForumNewItem::removeItem()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
mParent->lockLayout(this, true);
|
||||
hide();
|
||||
mParent->lockLayout(this, false);
|
||||
|
||||
if (mParent)
|
||||
{
|
||||
mParent->deleteFeedItem(this, mFeedId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*********** 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, "");
|
||||
CreateForumMsg *cfm = new CreateForumMsg(mForumId, "");
|
||||
cfm->show();
|
||||
}
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
/****************************************************************
|
||||
* 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 <stdint.h>
|
||||
|
||||
class FeedHolder;
|
||||
|
||||
class ForumNewItem : public QWidget, private Ui::ForumNewItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
ForumNewItem(FeedHolder *parent, uint32_t feedId, const std::string &forumId, bool isHome, bool isNew);
|
||||
|
||||
void updateItemStatic();
|
||||
|
||||
private slots:
|
||||
/* default stuff */
|
||||
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
|
||||
|
|
@ -1,317 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ForumNewItem</class>
|
||||
<widget class="QWidget" name="ForumNewItem">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>618</width>
|
||||
<height>157</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>215</red>
|
||||
<green>215</green>
|
||||
<blue>215</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>215</red>
|
||||
<green>215</green>
|
||||
<blue>215</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>215</red>
|
||||
<green>215</green>
|
||||
<blue>215</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>215</red>
|
||||
<green>215</green>
|
||||
<blue>215</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="forumlogo_label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>70</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>70</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/konversation64.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="titleLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="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 notr="true">Forum</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="nameLabel">
|
||||
<property name="text">
|
||||
<string notr="true">name</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>254</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="subscribeButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Subscribe to Forum</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/directoryadd_24x24_shadow.png</normaloff>:/images/directoryadd_24x24_shadow.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="postButton">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/mail_new.png</normaloff>:/images/mail_new.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="expandButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Expand</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Remove Item</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QFrame" name="expandFrame">
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Forum Description</string>
|
||||
</property>
|
||||
<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 hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Description
|
||||
of Forum</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -127,12 +127,12 @@ void MsgItem::updateItemStatic()
|
|||
title += srcName;
|
||||
|
||||
titleLabel->setText(title);
|
||||
subjectLabel->setText(QString::fromStdWString(mi.title));
|
||||
subjectLabel->setText(QString::fromUtf8(mi.title.c_str()));
|
||||
|
||||
if(mi.msgflags & RS_MSG_ENCRYPTED)
|
||||
msgLabel->setText(RsHtml().formatText(NULL, QString("[%1]").arg(tr("Encrypted message")), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||
else
|
||||
msgLabel->setText(RsHtml().formatText(NULL, QString::fromStdWString(mi.msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||
msgLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(mi.msg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
|
||||
|
||||
std::list<FileInfo>::iterator it;
|
||||
for(it = mi.files.begin(); it != mi.files.end(); it++)
|
||||
|
|
|
@ -312,8 +312,8 @@ void PeerItem::sendMessage()
|
|||
/* construct a message */
|
||||
MessageInfo mi;
|
||||
|
||||
mi.title = tr("Quick Message").toStdWString();
|
||||
mi.msg = quickmsgText->toHtml().toStdWString();
|
||||
mi.title = tr("Quick Message").toUtf8().constData();
|
||||
mi.msg = quickmsgText->toHtml().toUtf8().constData();
|
||||
mi.msgto.push_back(mPeerId);
|
||||
|
||||
rsMsgs->MessageSend(mi);
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "util/misc.h"
|
||||
#include "gui/RetroShareLink.h"
|
||||
|
||||
#include <retroshare/rschannels.h>
|
||||
//#include <retroshare/rschannels.h>
|
||||
|
||||
/****
|
||||
* #define DEBUG_ITEM 1
|
||||
|
@ -601,12 +601,15 @@ void SubFileItem::download()
|
|||
std::list<std::string> sources ;
|
||||
|
||||
std::string destination;
|
||||
#if 0
|
||||
if (!mChannelId.empty() && mType == SFI_TYPE_CHANNEL) {
|
||||
ChannelInfo ci;
|
||||
if (rsChannels->getChannelInfo(mChannelId, ci)) {
|
||||
destination = ci.destination_directory;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// Add possible direct sources.
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue