Merged branch v0.5-gxs-b1 into trunk (from -r 5351 -> 5995)

This brings a huge amount of goodness into the trunk,
but there is still a big chunk todo before it can be released.

 * GXS Backend.
 * GXS Services:
	- Identities.
	- Circles
	- Photos
	- Wiki
	- GxsForums
	- Posted.
 * SSH no-gui server.

See branch commits for more info.

To switch on GXS stuff, enable CONFIG += gxs
in both libretroshare.pro and retroshare-gui.pro



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5996 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2012-12-16 19:17:11 +00:00
commit 069b72e0b2
549 changed files with 111171 additions and 25579 deletions

View file

@ -37,12 +37,13 @@
#define COLUMN_COUNT 2
#define COLUMN_DATA COLUMN_NAME
#define ROLE_ID Qt::UserRole
#define ROLE_NAME Qt::UserRole + 1
#define ROLE_DESCRIPTION Qt::UserRole + 2
#define ROLE_POPULARITY Qt::UserRole + 3
#define ROLE_LASTPOST Qt::UserRole + 4
#define ROLE_SEARCH_SCORE Qt::UserRole + 5
#define ROLE_ID Qt::UserRole
#define ROLE_NAME Qt::UserRole + 1
#define ROLE_DESCRIPTION Qt::UserRole + 2
#define ROLE_POPULARITY Qt::UserRole + 3
#define ROLE_LASTPOST Qt::UserRole + 4
#define ROLE_SEARCH_SCORE Qt::UserRole + 5
#define ROLE_SUBSCRIBE_FLAGS Qt::UserRole + 6
#define ROLE_COLOR Qt::UserRole + 6
#define FILTER_NAME_INDEX 0
@ -69,6 +70,7 @@ GroupTreeWidget::GroupTreeWidget(QWidget *parent) :
connect(ui->treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customContextMenuRequested(QPoint)));
connect(ui->treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)));
connect(ui->treeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(itemClicked(QTreeWidgetItem*,int)));
/* Add own item delegate */
RSItemDelegate *itemDelegate = new RSItemDelegate(this);
@ -232,6 +234,19 @@ void GroupTreeWidget::currentItemChanged(QTreeWidgetItem *current, QTreeWidgetIt
emit treeCurrentItemChanged(id);
}
void GroupTreeWidget::itemClicked(QTreeWidgetItem *item, int column)
{
Q_UNUSED(column);
QString id;
if (item) {
id = item->data(COLUMN_DATA, ROLE_ID).toString();
}
emit treeItemClicked(id);
}
QTreeWidgetItem *GroupTreeWidget::addCategoryItem(const QString &name, const QIcon &icon, bool expand)
{
QFont font;
@ -318,6 +333,8 @@ void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList<
item->setToolTip(COLUMN_NAME, tooltip);
item->setToolTip(COLUMN_POPULARITY, tooltip);
item->setData(COLUMN_DATA, ROLE_SUBSCRIBE_FLAGS, itemInfo.subscribeFlags);
/* Set color */
QBrush brush;
if (itemInfo.privatekey) {
@ -413,6 +430,16 @@ QTreeWidgetItem *GroupTreeWidget::activateId(const QString &id, bool focus)
return item;
}
int GroupTreeWidget::subscribeFlags(const QString &id)
{
QTreeWidgetItem *item = getItemFromId(id);
if (item == NULL) {
return 0;
}
return item->data(COLUMN_DATA, ROLE_SUBSCRIBE_FLAGS).toInt();
}
void GroupTreeWidget::calculateScore(QTreeWidgetItem *item, const QString &filterText)
{
if (item) {

View file

@ -47,6 +47,7 @@ public:
{
popularity = 0;
privatekey = false;
subscribeFlags = 0;
}
public:
@ -57,6 +58,7 @@ public:
QDateTime lastpost;
QIcon icon;
bool privatekey;
int subscribeFlags;
};
class GroupTreeWidget : public QWidget
@ -93,9 +95,12 @@ public:
void setTextColorCategory(QColor color) { mTextColor[GROUPTREEWIDGET_COLOR_CATEGORY] = color; }
void setTextColorPrivateKey(QColor color) { mTextColor[GROUPTREEWIDGET_COLOR_PRIVATEKEY] = color; }
int subscribeFlags(const QString &id);
signals:
void treeCustomContextMenuRequested(const QPoint &pos);
void treeCurrentItemChanged(const QString &id);
void treeItemClicked(const QString &id);
protected:
void changeEvent(QEvent *e);
@ -103,6 +108,7 @@ protected:
private slots:
void customContextMenuRequested(const QPoint &pos);
void currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
void itemClicked(QTreeWidgetItem *item, int column);
void filterChanged();
void sort();

View file

@ -1,4 +1,5 @@
#include <QDesktopServices>
#include <QPainter>
#include "LinkTextBrowser.h"
@ -34,3 +35,27 @@ void LinkTextBrowser::linkClicked(const QUrl &url)
QDesktopServices::openUrl(url);
}
void LinkTextBrowser::setPlaceholderText(const QString &text)
{
placeholderText = text;
viewport()->repaint();
}
void LinkTextBrowser::paintEvent(QPaintEvent *event)
{
QTextBrowser::paintEvent(event);
if (placeholderText.isEmpty() == false && document()->isEmpty()) {
QWidget *vieportWidget = viewport();
QPainter painter(vieportWidget);
QPen pen = painter.pen();
QColor color = pen.color();
color.setAlpha(128);
pen.setColor(color);
painter.setPen(pen);
painter.drawText(QRect(QPoint(), vieportWidget->size()), Qt::AlignHCenter | Qt::AlignVCenter | Qt::TextWordWrap, placeholderText);
}
}

View file

@ -10,8 +10,15 @@ class LinkTextBrowser : public QTextBrowser
public:
explicit LinkTextBrowser(QWidget *parent = 0);
void setPlaceholderText(const QString &text);
private slots:
void linkClicked(const QUrl &url);
protected:
void paintEvent(QPaintEvent *event);
QString placeholderText;
};
#endif // LINKTEXTBROWSER_H

View file

@ -0,0 +1,52 @@
/****************************************************************
* This file is distributed under the following license:
*
* Copyright (c) 2012, RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QPainter>
#include "RSTreeWidget.h"
RSTreeWidget::RSTreeWidget(QWidget *parent) : QTreeWidget(parent)
{
}
void RSTreeWidget::setPlaceholderText(const QString &text)
{
placeholderText = text;
viewport()->repaint();
}
void RSTreeWidget::paintEvent(QPaintEvent *event)
{
QTreeWidget::paintEvent(event);
if (placeholderText.isEmpty() == false && model() && model()->rowCount() == 0) {
QWidget *vieportWidget = viewport();
QPainter painter(vieportWidget);
QPen pen = painter.pen();
QColor color = pen.color();
color.setAlpha(128);
pen.setColor(color);
painter.setPen(pen);
painter.drawText(QRect(QPoint(), vieportWidget->size()), Qt::AlignHCenter | Qt::AlignVCenter | Qt::TextWordWrap, placeholderText);
}
}

View file

@ -0,0 +1,43 @@
/****************************************************************
* This file is distributed under the following license:
*
* Copyright (c) 2012, RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _RSTREEWIDGET_H
#define _RSTREEWIDGET_H
#include <QTreeWidget>
/* Subclassing QTreeWidget */
class RSTreeWidget : public QTreeWidget
{
Q_OBJECT
public:
RSTreeWidget(QWidget *parent = 0);
void setPlaceholderText(const QString &text);
protected:
void paintEvent(QPaintEvent *event);
QString placeholderText;
};
#endif