merged with upstream/master

This commit is contained in:
mr-alice 2016-09-01 19:52:31 +02:00
commit ade6017f74
469 changed files with 88476 additions and 59565 deletions

View file

@ -29,7 +29,10 @@
#include <retroshare/rsdisc.h>
#include <retroshare/rspeers.h>
#include "settings/rsharesettings.h"
#ifdef ENABLE_WEBUI
#include <microhttpd.h>
#endif
#include <QClipboard>
#include <QSysInfo>
@ -781,11 +784,13 @@ void AboutDialog::on_copy_button_clicked()
RsControl::instance()->getLibraries(libraries);
verInfo+=addLibraries("libretroshare", libraries);
#ifdef ENABLE_WEBUI
/* Add version numbers of RetroShare */
// Add versions here. Find a better place.
libraries.clear();
libraries.push_back(RsLibraryInfo("Libmicrohttpd", MHD_get_version()));
verInfo+=addLibraries("RetroShare", libraries);
#endif // ENABLE_WEBUI
/* Add version numbers of plugins */
if (rsPlugins) {

View file

@ -221,7 +221,7 @@ void ChatLobbyWidget::updateNotify(ChatLobbyId id, unsigned int count)
dialog->getChatWidget()->setNotify(myChatLobbyUserNotify);
if (count>0){
notifyButton->setVisible(true);
notifyButton->setIcon(_lobby_infos[id].default_icon);
//notifyButton->setIcon(_lobby_infos[id].default_icon);
notifyButton->setToolTip(QString("(%1)").arg(count));
} else {
notifyButton->setVisible(false);
@ -1076,11 +1076,21 @@ void ChatLobbyWidget::readChatLobbyInvites()
tr("%1 invites you to chat lobby named %2").arg(QString::fromUtf8(rsPeers->getPeerName((*it).peer_id).c_str())).arg(RsHtml::plainText(it->lobby_name)),
QMessageBox::Question, QMessageBox::Yes,QMessageBox::No, 0);
QLabel *label = new QLabel(tr("Choose an identity for this lobby:"));
GxsIdChooser *idchooser = new GxsIdChooser ;
idchooser->loadIds(IDCHOOSER_ID_REQUIRED,default_id) ;
mb.layout()->addWidget(new QLabel(tr("Choose an identity for this lobby:"))) ;
mb.layout()->addWidget(idchooser) ;
QGridLayout* layout = qobject_cast<QGridLayout*>(mb.layout());
if (layout) {
layout->addWidget(label, layout->rowCount(), 0, 1, layout->columnCount(), Qt::AlignHCenter ) ;
layout->addWidget(idchooser, layout->rowCount(), 0, 1, layout->columnCount(), Qt::AlignRight ) ;
} else {
//Not QGridLayout so add at end
mb.layout()->addWidget(label) ;
mb.layout()->addWidget(idchooser) ;
}
int res = mb.exec() ;

View file

@ -6,7 +6,7 @@
#include "RsAutoUpdatePage.h"
#include "chat/ChatLobbyUserNotify.h"
#define IMAGE_CHATLOBBY ":/icons/chat_128.png"
#define IMAGE_CHATLOBBY ":/icons/png/chat-lobbies.png"
#define CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC 1
#define CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE 2

View file

@ -52,14 +52,20 @@
</property>
<item>
<widget class="QLabel" name="titleBarPixmap">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/chat_22.png</pixmap>
<pixmap resource="icons.qrc">:/icons/png/chat-lobbies.png</pixmap>
</property>
<property name="scaledContents">
<bool>false</bool>
<bool>true</bool>
</property>
</widget>
</item>
@ -156,8 +162,8 @@
<string/>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/add_chat24.png</normaloff>:/images/add_chat24.png</iconset>
<iconset resource="icons.qrc">
<normaloff>:/icons/png/add.png</normaloff>:/icons/png/add.png</iconset>
</property>
<property name="iconSize">
<size>
@ -435,6 +441,7 @@
</customwidgets>
<resources>
<include location="images.qrc"/>
<include location="icons.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -256,6 +256,7 @@
</customwidgets>
<resources>
<include location="../images.qrc"/>
<include location="../icons.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -55,7 +55,7 @@ CreateCircleDialog::CreateCircleDialog()
mCircleQueue = new TokenQueue(rsGxsCircles->getTokenService(), this);
mIdQueue = new TokenQueue(rsIdentity->getTokenService(), this);
ui.headerFrame->setHeaderImage(QPixmap(":/images/circles/circles_64.png"));
ui.headerFrame->setHeaderImage(QPixmap(":/icons/png/circles.png"));
// connect up the buttons.
connect(ui.addButton, SIGNAL(clicked()), this, SLOT(addMember()));
@ -103,7 +103,7 @@ CreateCircleDialog::CreateCircleDialog()
#endif
//ui.idChooser->loadIds(0,RsGxsId());
ui.circleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_EXTERNAL, RsGxsCircleId());
ui.circleComboBox->loadCircles(RsGxsCircleId());
}
CreateCircleDialog::~CreateCircleDialog()
@ -604,7 +604,7 @@ void CreateCircleDialog::updateCircleGUI()
else
ui.radioButton_Restricted->setChecked(true);
ui.circleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_EXTERNAL, mCircleGroup.mMeta.mCircleId);
ui.circleComboBox->loadCircles(mCircleGroup.mMeta.mCircleId);
break;

View file

@ -373,6 +373,16 @@
<property name="text">
<string>Public</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/network-puplic.png</normaloff>:/icons/png/network-puplic.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
@ -383,6 +393,16 @@
<property name="text">
<string>Private</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/person.png</normaloff>:/icons/png/person.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item row="0" column="2">
@ -393,6 +413,16 @@
<property name="text">
<string>Only visible to members of:</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/circles.png</normaloff>:/icons/png/circles.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item row="0" column="3">
@ -459,6 +489,7 @@
</customwidgets>
<resources>
<include location="../images.qrc"/>
<include location="../icons.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -41,12 +41,12 @@ bool TransferUserNotify::hasSetting(QString *name, QString *group)
QIcon TransferUserNotify::getIcon()
{
return QIcon(":/images/ktorrent32.png");
return QIcon(":/icons/png/filesharing.png");
}
QIcon TransferUserNotify::getMainIcon(bool hasNew)
{
return hasNew ? QIcon(":/icons/ktorrent_red_128.png") : QIcon(":/icons/ktorrent_128.png");
return hasNew ? QIcon(":/icons/png/filesharing-notify.png") : QIcon(":/icons/png/filesharing.png");
}
unsigned int TransferUserNotify::getNewCount()

View file

@ -76,7 +76,7 @@
#define IMAGE_PRIORITYNORMAL ":/images/prioritynormal.png"
#define IMAGE_PRIORITYHIGH ":/images/priorityhigh.png"
#define IMAGE_PRIORITYAUTO ":/images/priorityauto.png"
#define IMAGE_SEARCH ":/images/filefind.png"
#define IMAGE_SEARCH ":/icons/svg/magnifying-glass.svg"
#define IMAGE_EXPAND ":/images/edit_add24.png"
#define IMAGE_COLLAPSE ":/images/edit_remove24.png"
#define IMAGE_LIBRARY ":/images/library.png"
@ -84,8 +84,8 @@
#define IMAGE_COLLMODIF ":/images/library_edit.png"
#define IMAGE_COLLVIEW ":/images/library_view.png"
#define IMAGE_COLLOPEN ":/images/library.png"
#define IMAGE_FRIENDSFILES ":/images/fileshare16.png"
#define IMAGE_MYFILES ":images/my_documents_16.png"
#define IMAGE_FRIENDSFILES ":/icons/svg/folders.svg"
#define IMAGE_MYFILES ":icons/svg/folders1.svg"
#define IMAGE_RENAMEFILE ":images/filecomments.png"
#define IMAGE_STREAMING ":images/streaming.png"

View file

@ -38,19 +38,34 @@
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="titleBarPixmap">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/hi24-app-ktorrent.png</pixmap>
<pixmap resource="../icons.qrc">:/icons/png/filesharing.png</pixmap>
</property>
<property name="scaledContents">
<bool>false</bool>
<bool>true</bool>
</property>
</widget>
</item>
@ -105,27 +120,42 @@
<property name="currentIndex">
<number>0</number>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="movable">
<bool>false</bool>
</property>
<widget class="QWidget" name="tab">
<attribute name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/down.png</normaloff>:/images/down.png</iconset>
<iconset resource="../icons.qrc">
<normaloff>:/icons/svg/download.svg</normaloff>:/icons/svg/download.svg</iconset>
</attribute>
<attribute name="title">
<string>Downloads</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QSplitter" name="splitter">
<property name="minimumSize">
@ -191,6 +221,12 @@
<property name="currentIndex">
<number>0</number>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="elideMode">
<enum>Qt::ElideNone</enum>
</property>
@ -208,14 +244,23 @@
</property>
<widget class="QWidget" name="uploadsTab">
<attribute name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/uploads.png</normaloff>:/images/uploads.png</iconset>
<iconset resource="../icons.qrc">
<normaloff>:/icons/svg/upload.svg</normaloff>:/icons/svg/upload.svg</iconset>
</attribute>
<attribute name="title">
<string>Uploads</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
@ -248,6 +293,7 @@
</customwidgets>
<resources>
<include location="../images.qrc"/>
<include location="../icons.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -51,10 +51,10 @@
/* Images for Newsfeed icons */
//#define IMAGE_NEWSFEED ""
//#define IMAGE_NEWSFEED_NEW ":/images/message-state-new.png"
#define IMAGE_NETWORK2 ":/images/logo/logo_16.png"
#define IMAGE_PEERS ":/images/groupchat.png"
#define IMAGE_NETWORK2 ":/icons/png/netgraph.png"
#define IMAGE_PEERS ":/icons/png/keyring.png"
#define IMAGE_IDENTITY ":/images/identity/identities_32.png"
#define IMAGE_CIRCLES ":/images/circles/circles_32.png"
#define IMAGE_CIRCLES ":/icons/png/circles.png"
/******
* #define FRIENDS_DEBUG 1

View file

@ -26,7 +26,7 @@
#include "ui_FriendsDialog.h"
#define IMAGE_NETWORK ":/icons/logo_128.png"
#define IMAGE_NETWORK ":/icons/png/network.png"
class QAction;
class NetworkDialog;

View file

@ -11,7 +11,16 @@
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
@ -29,16 +38,34 @@
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="titleBarPixmap">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/logo/logo_24.png</pixmap>
<pixmap resource="icons.qrc">:/icons/png/network.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
@ -193,13 +220,19 @@
<property name="currentIndex">
<number>0</number>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="tabsClosable">
<bool>true</bool>
</property>
<widget class="QWidget" name="groupChatTab">
<attribute name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/kblogger.png</normaloff>:/images/kblogger.png</iconset>
<iconset resource="icons.qrc">
<normaloff>:/icons/png/chat-lobbies.png</normaloff>:/icons/png/chat-lobbies.png</iconset>
</attribute>
<attribute name="title">
<string>Broadcast</string>
@ -357,6 +390,7 @@
</customwidgets>
<resources>
<include location="images.qrc"/>
<include location="icons.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -19,19 +19,26 @@
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <rshare.h>
#include <util/rsrandom.h>
#include <retroshare/rsinit.h>
#include <rsserver/rsaccounts.h>
#include "GenCertDialog.h"
#include <QAbstractEventDispatcher>
#include <QFileDialog>
#include <QGraphicsOpacityEffect>
#include <QTimer>
#include <QMessageBox>
#include <QMouseEvent>
#include <QTextBrowser>
#include <QTimer>
#include <QProgressBar>
#include <rshare.h>
#include "gui/settings/rsharesettings.h"
#include "util/misc.h"
#include <retroshare/rsidentity.h>
#include <retroshare/rsinit.h>
#include <rsserver/rsaccounts.h>
#include <util/rsrandom.h>
#include <time.h>
#include <math.h>
#include <iostream>
@ -97,18 +104,18 @@ void GenCertDialog::grabMouse()
ui.entropy_bar->setValue(count*100/2048) ;
if(ui.entropy_bar->value() < 20)
{
ui.genButton2->setEnabled(false) ;
ui.genButton2->setIcon(QIcon(":/images/delete.png")) ;
ui.genButton2->setToolTip(tr("Currently disabled. Please move your mouse around until you reach at least 20%")) ;
}
else
{
ui.genButton2->setEnabled(true) ;
ui.genButton2->setIcon(QIcon(":/images/resume.png")) ;
ui.genButton2->setToolTip(tr("Click to create your node and/or profile")) ;
}
if(ui.entropy_bar->value() < 20)
{
ui.genButton->setEnabled(false) ;
ui.genButton->setIcon(QIcon(":/images/delete.png")) ;
ui.genButton->setToolTip(tr("Currently disabled. Please move your mouse around until you reach at least 20%")) ;
}
else
{
ui.genButton->setEnabled(true) ;
ui.genButton->setIcon(QIcon(":/images/resume.png")) ;
ui.genButton->setToolTip(tr("Click to create your node and/or profile")) ;
}
RsInit::collectEntropy(E+(F << 16)) ;
}
@ -119,7 +126,9 @@ void GenCertDialog::grabMouse()
//}
/** Default constructor */
GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent)
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), mOnlyGenerateIdentity(onlyGenerateIdentity)
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
, mOnlyGenerateIdentity(onlyGenerateIdentity)
, mGXSNickname("")
{
/* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this);
@ -128,10 +137,10 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent)
ui.headerFrame->setHeaderText(tr("Create a new profile"));
connect(ui.new_gpg_key_checkbox, SIGNAL(clicked()), this, SLOT(newGPGKeyGenUiSetup()));
connect(ui.adv_checkbox, SIGNAL(clicked()), this, SLOT(updateUiSetup()));
connect(ui.hidden_checkbox, SIGNAL(clicked()), this, SLOT(updateUiSetup()));
connect(ui.adv_checkbox, SIGNAL(clicked()), this, SLOT(updateUiSetup()));
connect(ui.hidden_checkbox, SIGNAL(clicked()), this, SLOT(updateUiSetup()));
connect(ui.genButton2, SIGNAL(clicked()), this, SLOT(genPerson()));
connect(ui.genButton, SIGNAL(clicked()), this, SLOT(genPerson()));
connect(ui.importIdentity_PB, SIGNAL(clicked()), this, SLOT(importIdentity()));
connect(ui.exportIdentity_PB, SIGNAL(clicked()), this, SLOT(exportIdentity()));
@ -160,17 +169,20 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent)
// make sure that QVariant always takes an 'int' otherwise the program will crash!
ui.keylength_comboBox->addItem("default (2048 bits, recommended)", QVariant(2048));
ui.keylength_comboBox->addItem("high (3072 bits)", QVariant(3072));
ui.keylength_comboBox->addItem("insane (4096 bits)", QVariant(4096));
ui.keylength_comboBox->addItem("insane (4096 bits)", QVariant(4096));
#if QT_VERSION >= 0x040700
ui.email_input->setPlaceholderText(tr("[Optional] Visible to your friends, and friends of friends.")) ;
ui.node_input->setPlaceholderText(tr("[Required] Examples: Home, Laptop,...")) ;
ui.hiddenaddr_input->setPlaceholderText(tr("[Required] Tor/I2P address - Examples: xa76giaf6ifda7ri63i263.onion (obtained by you from Tor)")) ;
ui.name_input->setPlaceholderText(tr("[Required] Visible to your friends, and friends of friends."));
ui.nickname_input->setPlaceholderText(tr("[Optional] Used when you write in chat lobbies, forums and channel comments. Can be setup later if you need one."));
ui.password_input->setPlaceholderText(tr("[Required] This password protects your private PGP key."));
ui.password_input_2->setPlaceholderText(tr("[Required] Type the same password again here."));
#endif
ui.nickname_input->setMaxLength(RSID_MAXIMUM_NICKNAME_SIZE);
ui.node_input->setToolTip(tr("Enter a meaningful node description. e.g. : home, laptop, etc. \nThis field will be used to differentiate different installations with\nthe same profile (PGP key pair).")) ;
ui.email_input->hide() ;
@ -221,7 +233,7 @@ void GenCertDialog::init()
ui.header_label->show();
ui.new_gpg_key_checkbox->setChecked(false);
setWindowTitle(tr("Create new node"));
ui.genButton2->setText(tr("Generate new node"));
ui.genButton->setText(tr("Generate new node"));
ui.headerFrame->setHeaderText(tr("Create a new node"));
genNewGPGKey = false;
} else {
@ -230,7 +242,7 @@ void GenCertDialog::init()
ui.new_gpg_key_checkbox->setChecked(true);
ui.new_gpg_key_checkbox->setEnabled(true);
setWindowTitle(tr("Create new profile"));
ui.genButton2->setText(tr("Generate new profile and node"));
ui.genButton->setText(tr("Generate new profile and node"));
ui.headerFrame->setHeaderText(tr("Create a new profile and node"));
genNewGPGKey = true;
}
@ -269,35 +281,45 @@ void GenCertDialog::newGPGKeyGenUiSetup() {
if (ui.new_gpg_key_checkbox->isChecked()) {
genNewGPGKey = true;
setWindowTitle(tr("Create new profile"));
ui.headerFrame->setHeaderText(tr("Create a new profile and node"));
if (!mOnlyGenerateIdentity) {
ui.header_label->setVisible(haveGPGKeys);
}
ui.genprofileinfo_label->setVisible(false);
ui.no_gpg_key_label->setText(tr("Welcome to Retroshare. Before you can proceed you need to create a profile and associate a node with it. To do so please fill out this form.\nAlternatively you can import a (previously exported) profile. Just uncheck \"Create a new profile\""));
ui.importIdentity_PB->hide() ;
ui.exportIdentity_PB->hide();
ui.adv_checkbox->setVisible(true);
ui.genPGPuserlabel->hide();
ui.genPGPuser->hide();
ui.name_label->show();
ui.name_input->show();
ui.nickname_label->setVisible(!mOnlyGenerateIdentity);
ui.nickname_input->setVisible(!mOnlyGenerateIdentity);
ui.node_label->setVisible(true);
ui.node_input->setVisible(true);
// ui.email_label->show();
// ui.email_input->show();
ui.password_label->show();
ui.password_label_2->show();
ui.password_input->show();
ui.password_input_2->show();
ui.genPGPuserlabel->hide();
ui.genPGPuser->hide();
ui.importIdentity_PB->hide() ;
ui.exportIdentity_PB->hide();
setWindowTitle(tr("Create new profile"));
ui.genButton2->setText(tr("Generate new profile and node"));
ui.headerFrame->setHeaderText(tr("Create a new profile and node"));
ui.no_gpg_key_label->setText(tr("Welcome to Retroshare. Before you can proceed you need to create a profile and associate a node with it. To do so please fill out this form.\nAlternatively you can import a (previously exported) profile. Just uncheck \"Create a new profile\""));
ui.genButton2->setVisible(true);
ui.adv_checkbox->setVisible(true);
ui.node_label->setVisible(true);
ui.node_input->setVisible(true);
ui.entropy_label->setVisible(true);
ui.entropy_bar->setVisible(true);
ui.genprofileinfo_label->setVisible(false);
if (!mOnlyGenerateIdentity) {
ui.header_label->setVisible(haveGPGKeys);
}
//ui.keylength_label->show();
//ui.keylength_comboBox->show();
ui.entropy_label->setVisible(true);
ui.entropy_bar->setVisible(true);
ui.genButton->setVisible(true);
ui.genButton->setText(tr("Generate new profile and node"));
} else {
genNewGPGKey = false;
setWindowTitle(tr("Create new node"));
ui.headerFrame->setHeaderText(tr("Create a new node"));
ui.header_label->setVisible(false);
//haveGPGKeys = (ui.genPGPuser->count() != 0)?true:false;
if (haveGPGKeys) {
QVariant data = ui.genPGPuser->itemData(ui.genPGPuser->currentIndex());
@ -308,37 +330,39 @@ void GenCertDialog::newGPGKeyGenUiSetup() {
ui.genprofileinfo_label->show();
}
}
genNewGPGKey = false;
ui.name_label->hide();
ui.name_input->hide();
// ui.email_label->hide();
// ui.email_input->hide();
ui.password_label->hide();
ui.password_label_2->hide();
ui.password_input->hide();
ui.password_input_2->hide();
ui.genPGPuserlabel->show();
ui.genPGPuser->show();
//ui.genprofileinfo_label->show();
ui.no_gpg_key_label->setText(tr("Welcome to Retroshare. Before you can proceed you need to import a profile and after that associate a node with it."));
ui.importIdentity_PB->setVisible(!mOnlyGenerateIdentity);
ui.exportIdentity_PB->setVisible(haveGPGKeys);
ui.exportIdentity_PB->setEnabled(haveGPGKeys);
setWindowTitle(tr("Create new node"));
ui.genButton2->setText(tr("Generate new node"));
ui.headerFrame->setHeaderText(tr("Create a new node"));
ui.no_gpg_key_label->setText(tr("Welcome to Retroshare. Before you can proceed you need to import a profile and after that associate a node with it."));
ui.genButton2->setVisible(haveGPGKeys);
ui.adv_checkbox->setVisible(haveGPGKeys);
ui.adv_checkbox->setChecked(haveGPGKeys && adv_state);
ui.genPGPuser->setVisible(haveGPGKeys);
//ui.genPGPuserlabel->show();
//ui.genPGPuser->show();
ui.genPGPuserlabel->setVisible(haveGPGKeys);
ui.genPGPuser->setVisible(haveGPGKeys);
ui.name_label->hide();
ui.name_input->hide();
ui.nickname_label->setVisible(!mOnlyGenerateIdentity && haveGPGKeys);
ui.nickname_input->setVisible(!mOnlyGenerateIdentity && haveGPGKeys);
ui.node_label->setVisible(haveGPGKeys);
ui.node_input->setVisible(haveGPGKeys);
ui.entropy_label->setVisible(haveGPGKeys);
ui.entropy_bar->setVisible(haveGPGKeys);
//ui.genprofileinfo_label->show();
ui.header_label->setVisible(false);
// ui.email_label->hide();
// ui.email_input->hide();
ui.password_label->hide();
ui.password_input->hide();
ui.password_label_2->hide();
ui.password_input_2->hide();
ui.keylength_label->hide();
ui.keylength_comboBox->hide();
ui.entropy_label->setVisible(haveGPGKeys);
ui.entropy_bar->setVisible(haveGPGKeys);
ui.genButton->setText(tr("Generate new node"));
ui.genButton->setVisible(haveGPGKeys);
}
updateUiSetup();
ui.adv_checkbox->setChecked(adv_state);
@ -347,10 +371,10 @@ void GenCertDialog::newGPGKeyGenUiSetup() {
void GenCertDialog::updateUiSetup()
{
if (ui.adv_checkbox->isChecked())
{
ui.hidden_checkbox->show();
if (ui.adv_checkbox->isChecked())
{
ui.hidden_checkbox->show();
if (ui.new_gpg_key_checkbox->isChecked())
{
// key length is only for pgp key creation
@ -362,39 +386,39 @@ void GenCertDialog::updateUiSetup()
ui.keylength_label->hide();
ui.keylength_comboBox->hide();
}
if(ui.hidden_checkbox->isChecked())
{
ui.hiddenaddr_input->show();
ui.hiddenaddr_label->show();
ui.label_hiddenaddr2->show();
ui.hiddenport_label->show();
ui.hiddenport_spinBox->show();
}
else
{
ui.hiddenaddr_input->hide();
ui.hiddenaddr_label->hide();
ui.label_hiddenaddr2->hide();
ui.hiddenport_label->hide();
ui.hiddenport_spinBox->hide();
}
}
else
{
ui.hiddenaddr_input->hide();
ui.hiddenaddr_label->hide();
ui.label_hiddenaddr2->hide();
ui.hiddenport_label->hide();
ui.hiddenport_spinBox->hide();
ui.hidden_checkbox->hide();
ui.keylength_label->hide();
ui.keylength_comboBox->hide();
if(ui.hidden_checkbox->isChecked())
{
ui.hiddenaddr_input->show();
ui.hiddenaddr_label->show();
ui.label_hiddenaddr->show();
ui.hiddenport_label->show();
ui.hiddenport_spinBox->show();
}
else
{
ui.hiddenaddr_input->hide();
ui.hiddenaddr_label->hide();
ui.label_hiddenaddr->hide();
ui.hiddenport_label->hide();
ui.hiddenport_spinBox->hide();
}
}
else
{
ui.hiddenaddr_input->hide();
ui.hiddenaddr_label->hide();
ui.label_hiddenaddr->hide();
ui.hiddenport_label->hide();
ui.hiddenport_spinBox->hide();
if(ui.hidden_checkbox->isChecked())
ui.hidden_checkbox->setChecked(false) ;
}
ui.hidden_checkbox->hide();
ui.keylength_label->hide();
ui.keylength_comboBox->hide();
if(ui.hidden_checkbox->isChecked())
ui.hidden_checkbox->setChecked(false) ;
}
}
@ -402,8 +426,8 @@ void GenCertDialog::exportIdentity()
{
QString fname = QFileDialog::getSaveFileName(this,tr("Export profile"), "",tr("RetroShare profile files (*.asc)")) ;
if(fname.isNull())
return ;
if(fname.isNull()) return ;
if(fname.right(4).toUpper() != ".ASC") fname += ".asc";
QVariant data = ui.genPGPuser->itemData(ui.genPGPuser->currentIndex());
RsPgpId gpg_id (data.toString().toStdString()) ;
@ -416,7 +440,9 @@ void GenCertDialog::exportIdentity()
void GenCertDialog::importIdentity()
{
QString fname = QFileDialog::getOpenFileName(this,tr("Import profile"), "",tr("RetroShare profile files (*.asc)")) ;
QString fname ;
if(!misc::getOpenFileName(this,RshareSettings::LASTDIR_CERT,tr("Import profile"), tr("RetroShare profile files (*.asc);;All files (*)"),fname))
return ;
if(fname.isNull())
return ;
@ -449,7 +475,30 @@ void GenCertDialog::genPerson()
RsPgpId PGPId;
bool isHiddenLoc = false;
if (ui.hidden_checkbox->isChecked())
mGXSNickname = ui.nickname_input->text();
if (!mGXSNickname.isEmpty())
{
if (mGXSNickname.size() < RSID_MINIMUM_NICKNAME_SIZE)
{
std::cerr << "GenCertDialog::genPerson() GXS Nickname too short (min " << RSID_MINIMUM_NICKNAME_SIZE<< " chars)";
std::cerr << std::endl;
QMessageBox::warning(this, "", tr("The GXS nickname is too short. Please input at least %1 characters.").arg(RSID_MINIMUM_NICKNAME_SIZE), QMessageBox::Ok, QMessageBox::Ok);
mGXSNickname = "";
return;
}
if (mGXSNickname.size() > RSID_MAXIMUM_NICKNAME_SIZE)
{
std::cerr << "GenCertDialog::genPerson() GXS Nickname too long (max " << RSID_MAXIMUM_NICKNAME_SIZE<< " chars)";
std::cerr << std::endl;
QMessageBox::warning(this, "", tr("The GXS nickname is too long. Please reduce the length to %1 characters.").arg(RSID_MAXIMUM_NICKNAME_SIZE), QMessageBox::Ok, QMessageBox::Ok);
mGXSNickname = "";
return;
}
}
if (ui.hidden_checkbox->isChecked())
{
std::string hl = ui.hiddenaddr_input->text().toStdString();
uint16_t port = ui.hiddenport_spinBox->value();
@ -511,6 +560,8 @@ void GenCertDialog::genPerson()
ui.new_gpg_key_checkbox->hide();
ui.name_label->hide();
ui.name_input->hide();
ui.nickname_label->hide();
ui.nickname_input->hide();
// ui.email_label->hide();
// ui.email_input->hide();
ui.password_label_2->hide();
@ -521,12 +572,12 @@ void GenCertDialog::genPerson()
ui.genPGPuser->hide();
ui.node_label->hide();
ui.node_input->hide();
ui.genButton2->hide();
ui.genButton->hide();
ui.importIdentity_PB->hide();
ui.genprofileinfo_label->hide();
ui.hidden_checkbox->hide();
ui.adv_checkbox->hide();
ui.keylength_label->hide();
ui.hidden_checkbox->hide();
ui.adv_checkbox->hide();
ui.keylength_label->hide();
ui.keylength_comboBox->hide();
setCursor(Qt::WaitCursor) ;
@ -565,6 +616,7 @@ void GenCertDialog::genPerson()
/* complete the process */
RsInit::LoadPassword(sslPasswd);
if (Rshare::loadCertificate(sslId, false)) {
accept();
}
}

View file

@ -36,6 +36,7 @@ public:
virtual ~GenCertDialog() ;
virtual void mouseMoveEvent(QMouseEvent *e) ;
QString getGXSNickname() {return mGXSNickname;}
private slots:
void genPerson();
void importIdentity();
@ -53,6 +54,7 @@ private:
bool genNewGPGKey;
bool haveGPGKeys;
bool mOnlyGenerateIdentity;
QString mGXSNickname;
QTimer *entropy_timer ;
};

View file

@ -17,7 +17,7 @@
<iconset resource="images.qrc">
<normaloff>:/images/logo/logo_48.png</normaloff>:/images/logo/logo_48.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<layout class="QVBoxLayout" name="GenCertDialogVLayout">
<item>
<widget class="HeaderFrame" name="headerFrame">
<property name="sizePolicy">
@ -219,7 +219,7 @@ Alternatively you can use an existing profile. Just uncheck &quot;Create a new p
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<layout class="QHBoxLayout" name="toolBarHLayout">
<item>
<widget class="QCheckBox" name="new_gpg_key_checkbox">
<property name="maximumSize">
@ -305,7 +305,7 @@ Alternatively you can use an existing profile. Just uncheck &quot;Create a new p
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<spacer name="toolBarHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -320,7 +320,7 @@ Alternatively you can use an existing profile. Just uncheck &quot;Create a new p
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0">
<layout class="QHBoxLayout" name="advOptionHLayout" stretch="0,0">
<property name="spacing">
<number>6</number>
</property>
@ -338,7 +338,7 @@ Alternatively you can use an existing profile. Just uncheck &quot;Create a new p
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<spacer name="hiddenNodeHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -353,107 +353,184 @@ Alternatively you can use an existing profile. Just uncheck &quot;Create a new p
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="genPGPuserlabel">
<property name="minimumSize">
<size>
<width>120</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>32</height>
</size>
</property>
<property name="text">
<string>Use profile</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="name_label">
<property name="minimumSize">
<size>
<width>120</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>32</height>
</size>
</property>
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="email_label">
<property name="text">
<string>Email</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="password_label">
<property name="toolTip">
<string>This password is for PGP</string>
</property>
<property name="text">
<string>Password</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="password_label_2">
<property name="toolTip">
<string>This password is for PGP</string>
</property>
<property name="text">
<string>Password (check)</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="node_label">
<property name="text">
<string>Node</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="hiddenaddr_label">
<property name="text">
<string>hidden address</string>
</property>
</widget>
</item>
</layout>
<layout class="QGridLayout" name="profilGLayout">
<item row="0" column="0">
<widget class="QLabel" name="genPGPuserlabel">
<property name="text">
<string>Use profile</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item row="0" column="1">
<widget class="QComboBox" name="genPGPuser">
<property name="toolTip">
<string>Your profile is associated with a PGP key pair. RetroShare currently ignores DSA keys.</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="name_label">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="name_input">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>32</height>
</size>
</property>
<property name="toolTip">
<string>Enter your nickname here</string>
</property>
<property name="maxLength">
<number>64</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="nickname_label">
<property name="toolTip">
<string/>
</property>
<property name="text">
<string>Chatrooms/Forums Nickname</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="nickname_input">
<property name="toolTip">
<string>You can have one or more identities. They are used when you write in chat lobbies, forums and channel comments. They act as the destination for distant chat and the Retroshare distant mail system.</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="email_label">
<property name="text">
<string>Email</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="email_input">
<property name="toolTip">
<string>Be careful: this email will be visible to your friends and friends
of your friends. This information is required by PGP, but to stay
anonymous, you can use a fake email.</string>
</property>
<property name="maxLength">
<number>64</number>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="password_label">
<property name="toolTip">
<string>This password is for PGP</string>
</property>
<property name="text">
<string>Password</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="password_input">
<property name="toolTip">
<string>Put a strong password here. This password protects your private PGP key.</string>
</property>
<property name="inputMask">
<string/>
</property>
<property name="maxLength">
<number>1024</number>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="password_label_2">
<property name="toolTip">
<string>This password is for PGP</string>
</property>
<property name="text">
<string>Password (check)</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="password_input_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Put a strong password here. This password protects your private PGP key.</string>
</property>
<property name="inputMask">
<string/>
</property>
<property name="maxLength">
<number>1024</number>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="node_label">
<property name="text">
<string>Node name</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="node_input">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maxLength">
<number>64</number>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="hiddenaddr_label">
<property name="text">
<string>hidden address</string>
</property>
</widget>
</item>
<item row="7" column="1">
<layout class="QHBoxLayout" name="hiddenInfoHLayout">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QComboBox" name="genPGPuser">
<property name="toolTip">
<string>Your profile is associated with a PGP key pair. RetroShare currently ignores DSA keys.</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="name_input">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QLineEdit" name="hiddenaddr_input">
<property name="minimumSize">
<size>
<width>0</width>
@ -466,171 +543,55 @@ Alternatively you can use an existing profile. Just uncheck &quot;Create a new p
<height>32</height>
</size>
</property>
<property name="toolTip">
<string>Enter your nickname here</string>
</property>
<property name="maxLength">
<number>64</number>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="email_input">
<property name="toolTip">
<string>Be careful: this email will be visible to your friends and friends
of your friends. This information is required by PGP, but to stay
anonymous, you can use a fake email.</string>
</property>
<property name="maxLength">
<number>64</number>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="password_input">
<property name="toolTip">
<string>Put a strong password here. This password protects your private PGP key.</string>
</property>
<property name="inputMask">
<string/>
</property>
<property name="maxLength">
<number>1024</number>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="password_input_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Put a strong password here. This password protects your private PGP key.</string>
</property>
<property name="inputMask">
<string/>
</property>
<property name="maxLength">
<number>1024</number>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="node_input">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maxLength">
<number>64</number>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QLineEdit" name="hiddenaddr_input">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>32</height>
</size>
</property>
<property name="maxLength">
<number>64</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="hiddenport_label">
<property name="text">
<string>Port</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="hiddenport_spinBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This is your connection port.&lt;/p&gt;&lt;p&gt;Any value between 1024 and 65535 &lt;/p&gt;&lt;p&gt;should be ok. You can change it later.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>7812</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_hiddenaddr2">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This can be a Tor Onion address of the form: xa76giaf6ifda7ri63i263.onion &lt;br/&gt;or an I2P address in the form: [52 characters].b32.i2p &lt;/p&gt;&lt;p&gt;In order to get one, you must configure either Tor or I2P to create a new hidden service / server tunnel. If you do not yet have one, you can still go on, and make it right later in RetroShare's Options-&amp;gt;Network-&amp;gt;Hidden Service configuration panel.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_1">
<item>
<layout class="QVBoxLayout" name="verticalLayout_1">
<item>
<widget class="QLabel" name="keylength_label">
<property name="minimumSize">
<size>
<width>120</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>32</height>
</size>
</property>
<widget class="QLabel" name="hiddenport_label">
<property name="text">
<string>PGP key length</string>
<string>Port</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="hiddenport_spinBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This is your connection port.&lt;/p&gt;&lt;p&gt;Any value between 1024 and 65535 &lt;/p&gt;&lt;p&gt;should be ok. You can change it later.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>7812</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QComboBox" name="keylength_comboBox"/>
</item>
</layout>
<item row="8" column="0" colspan="2">
<widget class="QLabel" name="label_hiddenaddr">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This can be a Tor Onion address of the form: xa76giaf6ifda7ri63i263.onion &lt;br/&gt;or an I2P address in the form: [52 characters].b32.i2p &lt;/p&gt;&lt;p&gt;In order to get one, you must configure either Tor or I2P to create a new hidden service / server tunnel. If you do not yet have one, you can still go on, and make it right later in RetroShare's Options-&amp;gt;Network-&amp;gt;Hidden Service configuration panel.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="keylength_label">
<property name="text">
<string>PGP key length</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QComboBox" name="keylength_comboBox"/>
</item>
</layout>
</item>
@ -722,7 +683,7 @@ anonymous, you can use a fake email.</string>
</widget>
</item>
<item>
<widget class="QPushButton" name="genButton2">
<widget class="QPushButton" name="genButton">
<property name="maximumSize">
<size>
<width>16777215</width>
@ -748,7 +709,7 @@ anonymous, you can use a fake email.</string>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<spacer name="mainVSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -761,30 +722,37 @@ anonymous, you can use a fake email.</string>
</spacer>
</item>
</layout>
<zorder>no_node_label</zorder>
<zorder>genButton2</zorder>
<zorder>header_label</zorder>
<zorder>genprofileinfo_label</zorder>
<zorder>entropy_bar</zorder>
<zorder>entropy_label</zorder>
<zorder>headerFrame</zorder>
<zorder>no_gpg_key_label</zorder>
<zorder>verticalSpacer</zorder>
<zorder>label_hiddenaddr2</zorder>
</widget>
<customwidgets>
<customwidget>
<class>StyledLabel</class>
<extends>QLabel</extends>
<header>gui/common/StyledLabel.h</header>
</customwidget>
<customwidget>
<class>HeaderFrame</class>
<extends>QFrame</extends>
<header>gui/common/HeaderFrame.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>StyledLabel</class>
<extends>QLabel</extends>
<header>gui/common/StyledLabel.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>new_gpg_key_checkbox</tabstop>
<tabstop>importIdentity_PB</tabstop>
<tabstop>exportIdentity_PB</tabstop>
<tabstop>adv_checkbox</tabstop>
<tabstop>hidden_checkbox</tabstop>
<tabstop>genPGPuser</tabstop>
<tabstop>name_input</tabstop>
<tabstop>nickname_input</tabstop>
<tabstop>email_input</tabstop>
<tabstop>password_input</tabstop>
<tabstop>password_input_2</tabstop>
<tabstop>node_input</tabstop>
<tabstop>hiddenaddr_input</tabstop>
<tabstop>hiddenport_spinBox</tabstop>
<tabstop>genButton</tabstop>
</tabstops>
<resources>
<include location="images.qrc"/>
</resources>

View file

@ -24,7 +24,10 @@
#include <retroshare/rsiface.h>
#include <retroshare/rsplugin.h>
#ifdef ENABLE_WEBUI
#include <microhttpd.h>
#endif // ENABLE_WEBUI
#include <QFile>
#include <QTextStream>
@ -94,11 +97,13 @@ HelpDialog::HelpDialog(QWidget *parent) :
RsControl::instance()->getLibraries(libraries);
addLibraries(ui->libraryLayout, "libretroshare", libraries);
#ifdef ENABLE_WEBUI
/* Add version numbers of RetroShare */
// Add versions here. Find a better place.
libraries.clear();
libraries.push_back(RsLibraryInfo("Libmicrohttpd", MHD_get_version()));
addLibraries(ui->libraryLayout, "RetroShare", libraries);
#endif // ENABLE_WEBUI
/* Add version numbers of plugins */
if (rsPlugins) {

View file

@ -26,7 +26,6 @@
#include "gui/common/UIStateHelper.h"
#include <retroshare/rspeers.h>
#include <retroshare/rsreputations.h>
// Data Requests.
#define IDDETAILSDIALOG_IDDETAILS 1
@ -261,7 +260,7 @@ void IdDetailsDialog::insertIdDetails(uint32_t token)
#endif
RsReputations::ReputationInfo info ;
rsReputations->getReputationInfo(RsGxsId(data.mMeta.mGroupId),info) ;
rsReputations->getReputationInfo(RsGxsId(data.mMeta.mGroupId),data.mPgpId,info) ;
ui->neighborNodesOpinion_TF->setText(QString::number(info.mOverallReputationScore-1.0f));

View file

@ -25,6 +25,7 @@
#include <QMessageBox>
#include <QMenu>
#include <QWidgetAction>
#include "IdDialog.h"
#include "ui_IdDialog.h"
@ -41,7 +42,6 @@
#include "util/QtVersion.h"
#include <retroshare/rspeers.h>
#include <retroshare/rsreputations.h>
#include "retroshare/rsgxsflags.h"
#include "retroshare/rsmsgs.h"
#include <iostream>
@ -93,6 +93,7 @@
#define RSID_FILTER_OTHERS 0x0004
#define RSID_FILTER_PSEUDONYMS 0x0008
#define RSID_FILTER_YOURSELF 0x0010
#define RSID_FILTER_BANNED 0x0020
#define RSID_FILTER_ALL 0xffff
#define IMAGE_EDIT ":/images/edit_16.png"
@ -193,8 +194,6 @@ IdDialog::IdDialog(QWidget *parent) :
//mStateHelper->addClear(IDDIALOG_REPLIST, ui->treeWidget_RepList);
/* Connect signals */
connect(ui->toolButton_NewId, SIGNAL(clicked()), this, SLOT(addIdentity()));
connect(ui->toolButton_NewCircle, SIGNAL(clicked()), this, SLOT(createExternalCircle()));
connect(ui->removeIdentity, SIGNAL(triggered()), this, SLOT(removeIdentity()));
connect(ui->editIdentity, SIGNAL(triggered()), this, SLOT(editIdentity()));
@ -203,22 +202,21 @@ IdDialog::IdDialog(QWidget *parent) :
connect(ui->idTreeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(updateSelection()));
connect(ui->idTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(IdListCustomPopupMenu(QPoint)));
connect(ui->filterComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(filterComboBoxChanged()));
connect(ui->filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
connect(ui->ownOpinion_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(modifyReputation()));
connect(ui->inviteButton, SIGNAL(clicked()), this, SLOT(sendInvite()));
ui->avlabel->setPixmap(QPixmap(":/images/user/friends64.png"));
ui->avlabel_Circles->setPixmap(QPixmap(":/icons/circles_128.png"));
ui->avLabel_Person->setPixmap(QPixmap(":/icons/png/people.png"));
ui->avlabel_Circles->setPixmap(QPixmap(":/icons/png/circles.png"));
ui->headerTextLabel->setText(tr("People"));
ui->headerTextLabel_Person->setText(tr("People"));
ui->headerTextLabel_Circles->setText(tr("Circles"));
/* Initialize splitter */
ui->splitter->setStretchFactor(0, 0);
ui->splitter->setStretchFactor(1, 1);
ui->mainSplitter->setStretchFactor(0, 0);
ui->mainSplitter->setStretchFactor(1, 1);
/*remove
QList<int> sizes;
@ -226,14 +224,72 @@ IdDialog::IdDialog(QWidget *parent) :
ui->splitter->setSizes(sizes);*/
/* Add filter types */
ui->filterComboBox->addItem(tr("All"), RSID_FILTER_ALL);
ui->filterComboBox->addItem(tr("Owned by myself"), RSID_FILTER_OWNED_BY_YOU);
ui->filterComboBox->addItem(tr("Linked to my node"), RSID_FILTER_YOURSELF);
ui->filterComboBox->addItem(tr("Linked to neighbor nodes"), RSID_FILTER_FRIENDS);
ui->filterComboBox->addItem(tr("Linked to distant nodes"), RSID_FILTER_OTHERS);
ui->filterComboBox->addItem(tr("Anonymous"), RSID_FILTER_PSEUDONYMS);
ui->filterComboBox->setCurrentIndex(0);
QMenu *idTWHMenu = new QMenu(tr("Show Items"), this);
ui->idTreeWidget->addContextMenuMenu(idTWHMenu);
QActionGroup *idTWHActionGroup = new QActionGroup(this);
QAction *idTWHAction = new QAction(QIcon(),tr("All"), this);
idTWHAction->setActionGroup(idTWHActionGroup);
idTWHAction->setCheckable(true);
idTWHAction->setChecked(true);
filter = RSID_FILTER_ALL;
idTWHAction->setData(RSID_FILTER_ALL);
connect(idTWHAction, SIGNAL(toggled(bool)), this, SLOT(filterToggled(bool)));
idTWHMenu->addAction(idTWHAction);
idTWHAction = new QAction(QIcon(),tr("Owned by myself"), this);
idTWHAction->setActionGroup(idTWHActionGroup);
idTWHAction->setCheckable(true);
idTWHAction->setData(RSID_FILTER_OWNED_BY_YOU);
connect(idTWHAction, SIGNAL(toggled(bool)), this, SLOT(filterToggled(bool)));
idTWHMenu->addAction(idTWHAction);
idTWHAction = new QAction(QIcon(),tr("Linked to my node"), this);
idTWHAction->setActionGroup(idTWHActionGroup);
idTWHAction->setCheckable(true);
idTWHAction->setData(RSID_FILTER_YOURSELF);
connect(idTWHAction, SIGNAL(toggled(bool)), this, SLOT(filterToggled(bool)));
idTWHMenu->addAction(idTWHAction);
idTWHAction = new QAction(QIcon(),tr("Linked to neighbor nodes"), this);
idTWHAction->setActionGroup(idTWHActionGroup);
idTWHAction->setCheckable(true);
idTWHAction->setData(RSID_FILTER_FRIENDS);
connect(idTWHAction, SIGNAL(toggled(bool)), this, SLOT(filterToggled(bool)));
idTWHMenu->addAction(idTWHAction);
idTWHAction = new QAction(QIcon(),tr("Linked to distant nodes"), this);
idTWHAction->setActionGroup(idTWHActionGroup);
idTWHAction->setCheckable(true);
idTWHAction->setData(RSID_FILTER_OTHERS);
connect(idTWHAction, SIGNAL(toggled(bool)), this, SLOT(filterToggled(bool)));
idTWHMenu->addAction(idTWHAction);
idTWHAction = new QAction(QIcon(),tr("Anonymous"), this);
idTWHAction->setActionGroup(idTWHActionGroup);
idTWHAction->setCheckable(true);
idTWHAction->setData(RSID_FILTER_PSEUDONYMS);
connect(idTWHAction, SIGNAL(toggled(bool)), this, SLOT(filterToggled(bool)));
idTWHMenu->addAction(idTWHAction);
idTWHAction = new QAction(QIcon(),tr("Banned"), this);
idTWHAction->setActionGroup(idTWHActionGroup);
idTWHAction->setCheckable(true);
idTWHAction->setData(RSID_FILTER_BANNED);
connect(idTWHAction, SIGNAL(toggled(bool)), this, SLOT(filterToggled(bool)));
idTWHMenu->addAction(idTWHAction);
QAction *CreateIDAction = new QAction(QIcon(":/icons/png/person.png"),tr("Create new Identity"), this);
connect(CreateIDAction, SIGNAL(triggered()), this, SLOT(addIdentity()));
QAction *CreateCircleAction = new QAction(QIcon(":/icons/png/circles.png"),tr("Create new circle"), this);
connect(CreateCircleAction, SIGNAL(triggered()), this, SLOT(createExternalCircle()));
QMenu *menu = new QMenu();
menu->addAction(CreateIDAction);
menu->addAction(CreateCircleAction);
ui->toolButton_New->setMenu(menu);
/* Add filter actions */
QTreeWidgetItem *headerItem = ui->idTreeWidget->headerItem();
QString headerText = headerItem->text(RSID_COL_NICKNAME);
@ -279,12 +335,10 @@ IdDialog::IdDialog(QWidget *parent) :
Signed identities are easier to trust but are easily linked to your node's IP address.</p> \
<p><b>Anonymous identities</b> allow you to anonymously interact with other users. They cannot be \
spoofed, but noone can prove who really owns a given identity.</p> \
<p><b>External circles</b> are groups of identities (anonymous or signed), that are shared at a distance over the network. They can be \
<p><b>Circles</b> are groups of identities (anonymous or signed), that are shared at a distance over the network. They can be \
used to restrict the visibility to forums, channels, etc. </p> \
<p>An <b>external circle</b> can be restricted to another circle, thereby limiting its visibility to members of that circle \
or even self-restricted, meaning that it is only visible to its members.</p> \
<p>A <b>local circle</b> is a group of friend nodes (represented by their PGP Ids), and can also be used to restrict the \
visibility of forums and channels. They are not shared over the network, and their list of members is only visible to you.</p>") ;
<p>An <b>circle</b> can be restricted to another circle, thereby limiting its visibility to members of that circle \
or even self-restricted, meaning that it is only visible to invited members.</p>") ;
registerHelpButton(ui->helpButton, hlp_str) ;
@ -295,6 +349,7 @@ IdDialog::IdDialog(QWidget *parent) :
//connect(ui->treeWidget_membership, SIGNAL(itemSelectionChanged()), this, SLOT(circle_selected()));
connect(ui->treeWidget_membership, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(CircleListCustomPopupMenu(QPoint)));
connect(ui->autoBanIdentities_CB, SIGNAL(toggled(bool)), this, SLOT(toggleAutoBanIdentities(bool)));
/* Setup TokenQueue */
@ -311,6 +366,17 @@ IdDialog::IdDialog(QWidget *parent) :
tmer->start(10000) ; // update every 10 secs.
}
void IdDialog::toggleAutoBanIdentities(bool b)
{
RsPgpId id(ui->lineEdit_GpgId->text().left(16).toStdString());
if(!id.isNull())
{
rsReputations->banNode(id,b) ;
requestIdList();
}
}
void IdDialog::updateCirclesDisplay()
{
if(RsAutoUpdatePage::eventsLocked())
@ -577,8 +643,8 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token)
#endif
// remove any identity that has an item, but no subscription flag entry
std::vector<QTreeWidgetItem*> to_delete ;
for(uint32_t k=0;k<item->childCount();++k)
for(uint32_t k=0; k < (uint32_t)item->childCount(); ++k)
if(details.mSubscriptionFlags.find(RsGxsId(item->child(k)->data(CIRCLEGROUP_CIRCLE_COL_GROUPID,Qt::UserRole).toString().toStdString())) == details.mSubscriptionFlags.end())
to_delete.push_back(item->child(k));
@ -600,7 +666,7 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token)
QTreeWidgetItem *subitem = NULL ;
// see if the item already exists
for(uint32_t k=0;k<item->childCount();++k)
for(uint32_t k=0; k < (uint32_t)item->childCount(); ++k)
if(item->child(k)->data(CIRCLEGROUP_CIRCLE_COL_GROUPID,Qt::UserRole).toString().toStdString() == it->first.toStdString())
{
subitem = item->child(k);
@ -1248,7 +1314,7 @@ void IdDialog::processSettings(bool load)
ui->filterLineEdit->setCurrentFilter(Settings->value("filterColumn", RSID_COL_NICKNAME).toInt());
// state of splitter
ui->splitter->restoreState(Settings->value("splitter").toByteArray());
ui->mainSplitter->restoreState(Settings->value("splitter").toByteArray());
} else {
// save settings
@ -1256,7 +1322,7 @@ void IdDialog::processSettings(bool load)
Settings->setValue("filterColumn", ui->filterLineEdit->currentFilter());
// state of splitter
Settings->setValue("splitter", ui->splitter->saveState());
Settings->setValue("splitter", ui->mainSplitter->saveState());
//save expanding
Settings->setValue("ExpandAll", allItem->isExpanded());
@ -1267,16 +1333,22 @@ void IdDialog::processSettings(bool load)
Settings->endGroup();
}
void IdDialog::filterComboBoxChanged()
{
requestIdList();
}
void IdDialog::filterChanged(const QString& /*text*/)
{
filterIds();
}
void IdDialog::filterToggled(const bool &value)
{
if (value) {
QAction *source = qobject_cast<QAction *>(QObject::sender());
if (source) {
filter = source->data().toInt();
requestIdList();
}
}
}
void IdDialog::updateSelection()
{
QTreeWidgetItem *item = ui->idTreeWidget->currentItem();
@ -1316,9 +1388,12 @@ void IdDialog::requestIdList()
bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item, const RsPgpId &ownPgpId, int accept)
{
bool isLinkedToOwnNode = (data.mPgpKnown && (data.mPgpId == ownPgpId)) ;
bool isOwnId = (data.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN);
uint32_t item_flags = 0 ;
bool isLinkedToOwnNode = (data.mPgpKnown && (data.mPgpId == ownPgpId)) ;
bool isOwnId = (data.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN);
RsIdentityDetails idd ;
rsIdentity->getIdDetails(RsGxsId(data.mMeta.mGroupId),idd) ;
bool isBanned = idd.mReputation.mAssessment == RsReputations::ASSESSMENT_BAD;
uint32_t item_flags = 0 ;
/* do filtering */
bool ok = false;
@ -1354,31 +1429,43 @@ bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item,
item_flags |= RSID_FILTER_OWNED_BY_YOU ;
}
if (isBanned && (accept & RSID_FILTER_BANNED))
{
ok = true;
item_flags |= RSID_FILTER_BANNED ;
}
if (!ok)
return false;
if (!item)
item = new TreeWidgetItem();
RsReputations::ReputationInfo info ;
rsReputations->getReputationInfo(RsGxsId(data.mMeta.mGroupId),info) ;
item->setText(RSID_COL_NICKNAME, QString::fromUtf8(data.mMeta.mGroupName.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE));
item->setText(RSID_COL_KEYID, QString::fromStdString(data.mMeta.mGroupId.toStdString()));
//time_t now = time(NULL) ;
//item->setText(RSID_COL_LASTUSED, getHumanReadableDuration(now - data.mLastUsageTS)) ;
if(isBanned)
{
item->setForeground(RSID_COL_NICKNAME,QBrush(Qt::red));
item->setForeground(RSID_COL_KEYID,QBrush(Qt::red));
item->setForeground(RSID_COL_IDTYPE,QBrush(Qt::red));
item->setForeground(RSID_COL_VOTES,QBrush(Qt::red));
}
else
{
item->setForeground(RSID_COL_NICKNAME,QBrush(Qt::black));
item->setForeground(RSID_COL_KEYID,QBrush(Qt::black));
item->setForeground(RSID_COL_IDTYPE,QBrush(Qt::black));
item->setForeground(RSID_COL_VOTES,QBrush(Qt::black));
}
item->setData(RSID_COL_KEYID, Qt::UserRole,QVariant(item_flags)) ;
item->setTextAlignment(RSID_COL_VOTES, Qt::AlignRight);
item->setData(RSID_COL_VOTES,Qt::DisplayRole, QString::number(info.mOverallReputationScore - 1.0f,'f',3));
item->setTextAlignment(RSID_COL_VOTES, Qt::AlignRight | Qt::AlignVCenter);
item->setData(RSID_COL_VOTES,Qt::DisplayRole, QString::number(idd.mReputation.mOverallReputationScore - 1.0f,'f',3));
if(isOwnId)
{
RsIdentityDetails idd ;
rsIdentity->getIdDetails(RsGxsId(data.mMeta.mGroupId),idd) ;
QFont font = item->font(RSID_COL_NICKNAME) ;
font.setBold(true) ;
@ -1455,7 +1542,7 @@ void IdDialog::insertIdList(uint32_t token)
{
mStateHelper->setLoading(IDDIALOG_IDLIST, false);
int accept = ui->filterComboBox->itemData(ui->filterComboBox->currentIndex()).toInt();
int accept = filter;
RsGxsIdGroup data;
std::vector<RsGxsIdGroup> datavector;
@ -1626,9 +1713,12 @@ void IdDialog::insertIdDetails(uint32_t token)
else
ui->lineEdit_GpgId->setText(QString::fromStdString(data.mPgpId.toStdString()) + tr(" [unverified]"));
ui->autoBanIdentities_CB->setVisible(!data.mPgpId.isNull()) ;
ui->banoption_label->setVisible(!data.mPgpId.isNull()) ;
time_t now = time(NULL) ;
ui->lineEdit_LastUsed->setText(getHumanReadableDuration(now - data.mLastUsageTS)) ;
ui->headerTextLabel->setText(QString::fromUtf8(data.mMeta.mGroupName.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE));
ui->headerTextLabel_Person->setText(QString::fromUtf8(data.mMeta.mGroupName.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE));
QPixmap pixmap ;
@ -1639,7 +1729,7 @@ void IdDialog::insertIdDetails(uint32_t token)
std::cerr << "Setting header frame image : " << pixmap.width() << " x " << pixmap.height() << std::endl;
#endif
ui->avlabel->setPixmap(pixmap);
ui->avLabel_Person->setPixmap(pixmap);
ui->avatarLabel->setPixmap(pixmap);
if (data.mPgpKnown)
@ -1659,23 +1749,23 @@ void IdDialog::insertIdDetails(uint32_t token)
if(data.mPgpId.isNull())
{
ui->lineEdit_GpgId->hide() ;
ui->PgpId_LB->hide() ;
ui->label_GpgId->hide() ;
}
else
{
ui->lineEdit_GpgId->show() ;
ui->PgpId_LB->show() ;
ui->label_GpgId->show() ;
}
if(data.mPgpKnown)
{
ui->lineEdit_GpgName->show() ;
ui->PgpName_LB->show() ;
ui->label_GpgName->show() ;
}
else
{
ui->lineEdit_GpgName->hide() ;
ui->PgpName_LB->hide() ;
ui->label_GpgName->hide() ;
}
bool isLinkedToOwnPgpId = (data.mPgpKnown && (data.mPgpId == ownPgpId)) ;
@ -1697,7 +1787,9 @@ void IdDialog::insertIdDetails(uint32_t token)
ui->lineEdit_Type->setText(tr("Linked to unknown Retroshare node")) ;
}
else
{
ui->lineEdit_Type->setText(tr("Anonymous identity")) ;
}
if (isOwnId)
{
@ -1717,6 +1809,8 @@ void IdDialog::insertIdDetails(uint32_t token)
ui->inviteButton->setEnabled(true);
}
ui->autoBanIdentities_CB->setChecked(rsReputations->isNodeBanned(data.mPgpId));
/* now fill in the reputation information */
#ifdef SUSPENDED
@ -1740,12 +1834,12 @@ void IdDialog::insertIdDetails(uint32_t token)
#endif
RsReputations::ReputationInfo info ;
rsReputations->getReputationInfo(RsGxsId(data.mMeta.mGroupId),info) ;
ui->neighborNodesOpinion_TF->setText(QString::number(info.mFriendAverage - 1.0f));
rsReputations->getReputationInfo(RsGxsId(data.mMeta.mGroupId),data.mPgpId,info) ;
ui->overallOpinion_TF->setText(QString::number(info.mOverallReputationScore - 1.0f) +" ("+
((info.mAssessment == RsReputations::ASSESSMENT_OK)? tr("OK") : tr("Banned")) +")" ) ;
ui->neighborNodesOpinion_TF->setText(QString::number(info.mFriendAverage - 1.0f));
ui->overallOpinion_TF->setText(QString::number(info.mOverallReputationScore - 1.0f) +" ("+
((info.mAssessment == RsReputations::ASSESSMENT_OK)? tr("OK") : tr("Banned")) +")" ) ;
switch(info.mOwnOpinion)
{
@ -1984,7 +2078,7 @@ void IdDialog::loadRequest(const TokenQueue * queue, const TokenRequest &req)
void IdDialog::IdListCustomPopupMenu( QPoint )
{
QMenu contextMnu( this );
QMenu *contextMenu = new QMenu(this);
std::list<RsGxsId> own_identities ;
@ -2021,10 +2115,10 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
#endif
RsGxsId keyId((*it)->text(RSID_COL_KEYID).toStdString());
RsReputations::ReputationInfo info ;
rsReputations->getReputationInfo(keyId,info) ;
RsIdentityDetails det ;
rsIdentity->getIdDetails(keyId,det) ;
switch(info.mOwnOpinion)
switch(det.mReputation.mOwnOpinion)
{
case RsReputations::OPINION_NEGATIVE: ++n_negative_reputations ;
break ;
@ -2044,75 +2138,105 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
++n_is_not_a_contact ;
}
if(root_node_present) // don't show menu if some of the root nodes are present
return ;
if(!root_node_present) // don't show menu if some of the root nodes are present
{
if(!one_item_owned_by_you)
{
if(n_selected_items == 1) // if only one item is selected, allow to chat with this item
if(own_identities.size() <= 1)
{
QAction *action = contextMnu.addAction(QIcon(":/images/chat_24.png"), tr("Chat with this person"), this, SLOT(chatIdentity()));
if(!one_item_owned_by_you)
{
QWidget *widget = new QWidget(contextMenu);
widget->setStyleSheet( ".QWidget{background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #FEFEFE, stop:1 #E8E8E8); border: 1px solid #CCCCCC;}");
if(own_identities.empty())
action->setEnabled(false) ;
else
action->setData(QString::fromStdString((own_identities.front()).toStdString())) ;
}
else
{
QMenu *mnu = contextMnu.addMenu(QIcon(":/images/chat_24.png"),tr("Chat with this person as...")) ;
// create menu header
QHBoxLayout *hbox = new QHBoxLayout(widget);
hbox->setMargin(0);
hbox->setSpacing(6);
for(std::list<RsGxsId>::const_iterator it=own_identities.begin();it!=own_identities.end();++it)
{
RsIdentityDetails idd ;
rsIdentity->getIdDetails(*it,idd) ;
QLabel *iconLabel = new QLabel(widget);
QPixmap pix = QPixmap(":/images/user/friends24.png").scaledToHeight(QFontMetricsF(iconLabel->font()).height()*1.5);
iconLabel->setPixmap(pix);
iconLabel->setMaximumSize(iconLabel->frameSize().height() + pix.height(), pix.width());
hbox->addWidget(iconLabel);
QPixmap pixmap ;
QLabel *textLabel = new QLabel("<strong>" + ui->titleBarLabel->text() + "</strong>", widget);
hbox->addWidget(textLabel);
if(idd.mAvatar.mSize == 0 || !pixmap.loadFromData(idd.mAvatar.mData, idd.mAvatar.mSize, "PNG"))
pixmap = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(*it)) ;
QSpacerItem *spacerItem = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
hbox->addItem(spacerItem);
QAction *action = mnu->addAction(QIcon(pixmap), QString("%1 (%2)").arg(QString::fromUtf8(idd.mNickname.c_str()), QString::fromStdString((*it).toStdString())), this, SLOT(chatIdentity()));
action->setData(QString::fromStdString((*it).toStdString())) ;
}
}
widget->setLayout(hbox);
// always allow to send messages
contextMnu.addAction(QIcon(":/images/mail_new.png"), tr("Send message"), this, SLOT(sendMsg()));
QWidgetAction *widgetAction = new QWidgetAction(this);
widgetAction->setDefaultWidget(widget);
contextMenu->addAction(widgetAction);
contextMnu.addSeparator();
if(n_selected_items == 1) // if only one item is selected, allow to chat with this item
{
if(own_identities.size() <= 1)
{
QAction *action = contextMenu->addAction(QIcon(":/images/chat_24.png"), tr("Chat with this person"), this, SLOT(chatIdentity()));
if(n_is_a_contact == 0)
contextMnu.addAction(QIcon(), tr("Add to Contacts"), this, SLOT(addtoContacts()));
if(n_is_not_a_contact == 0)
contextMnu.addAction(QIcon(":/images/cancel.png"), tr("Remove from Contacts"), this, SLOT(removefromContacts()));
if(own_identities.empty())
action->setEnabled(false) ;
else
action->setData(QString::fromStdString((own_identities.front()).toStdString())) ;
}
else
{
QMenu *mnu = contextMenu->addMenu(QIcon(":/images/chat_24.png"),tr("Chat with this person as...")) ;
contextMnu.addSeparator();
for(std::list<RsGxsId>::const_iterator it=own_identities.begin();it!=own_identities.end();++it)
{
RsIdentityDetails idd ;
rsIdentity->getIdDetails(*it,idd) ;
if(n_positive_reputations == 0) // only unban when all items are banned
contextMnu.addAction(QIcon(":/images/vote_up.png"), tr("Set positive opinion"), this, SLOT(positivePerson()));
QPixmap pixmap ;
if(n_neutral_reputations == 0) // only unban when all items are banned
contextMnu.addAction(QIcon(":/images/vote_neutral.png"), tr("Set neutral opinion"), this, SLOT(neutralPerson()));
if(n_negative_reputations == 0)
contextMnu.addAction(QIcon(":/images/vote_down.png"), tr("Set negative opinion"), this, SLOT(negativePerson()));
}
if(idd.mAvatar.mSize == 0 || !pixmap.loadFromData(idd.mAvatar.mData, idd.mAvatar.mSize, "PNG"))
pixmap = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(*it)) ;
if(one_item_owned_by_you && n_selected_items==1)
{
contextMnu.addSeparator();
QAction *action = mnu->addAction(QIcon(pixmap), QString("%1 (%2)").arg(QString::fromUtf8(idd.mNickname.c_str()), QString::fromStdString((*it).toStdString())), this, SLOT(chatIdentity()));
action->setData(QString::fromStdString((*it).toStdString())) ;
}
}
}
contextMnu.addAction(ui->editIdentity);
contextMnu.addAction(ui->removeIdentity);
}
// always allow to send messages
contextMenu->addAction(QIcon(":/images/mail_new.png"), tr("Send message"), this, SLOT(sendMsg()));
contextMenu->addSeparator();
contextMnu.addSeparator();
if(n_is_a_contact == 0)
contextMenu->addAction(QIcon(), tr("Add to Contacts"), this, SLOT(addtoContacts()));
contextMnu.exec(QCursor::pos());
if(n_is_not_a_contact == 0)
contextMenu->addAction(QIcon(":/images/cancel.png"), tr("Remove from Contacts"), this, SLOT(removefromContacts()));
contextMenu->addSeparator();
if(n_positive_reputations == 0) // only unban when all items are banned
contextMenu->addAction(QIcon(":/icons/png/thumbs-up.png"), tr("Set positive opinion"), this, SLOT(positivePerson()));
if(n_neutral_reputations == 0) // only unban when all items are banned
contextMenu->addAction(QIcon(":/icons/png/thumbs-neutral.png"), tr("Set neutral opinion"), this, SLOT(neutralPerson()));
if(n_negative_reputations == 0)
contextMenu->addAction(QIcon(":/icons/png/thumbs-down.png"), tr("Set negative opinion"), this, SLOT(negativePerson()));
}
if(one_item_owned_by_you && n_selected_items==1)
{
contextMenu->addSeparator();
contextMenu->addAction(ui->editIdentity);
contextMenu->addAction(ui->removeIdentity);
}
}
contextMenu = ui->idTreeWidget->createStandardContextMenu(contextMenu);
contextMenu->exec(QCursor::pos());
delete contextMenu;
}
void IdDialog::chatIdentity()

View file

@ -30,7 +30,7 @@
#include "util/TokenQueue.h"
#define IMAGE_IDDIALOG ":/icons/friends_128.png"
#define IMAGE_IDDIALOG ":/icons/png/people.png"
namespace Ui {
class IdDialog;
@ -77,14 +77,15 @@ private slots:
void createExternalCircle();
void showEditExistingCircle();
void updateCirclesDisplay();
void toggleAutoBanIdentities(bool b);
void acceptCircleSubscription() ;
void cancelCircleSubscription() ;
void grantCircleMembership() ;
void revokeCircleMembership() ;
void filterComboBoxChanged();
void filterChanged(const QString &text);
void filterToggled(const bool &value);
void addIdentity();
void removeIdentity();
@ -149,6 +150,7 @@ private:
std::map<uint32_t, CircleUpdateOrder> mCircleUpdates ;
RsGxsGroupId mId;
int filter;
/* UI - Designer */
Ui::IdDialog *ui;

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1475</width>
<height>1134</height>
<width>1269</width>
<height>911</height>
</rect>
</property>
<property name="sizePolicy">
@ -19,8 +19,17 @@
<property name="windowTitle">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<property name="margin">
<layout class="QGridLayout" name="IdDialogGLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
@ -37,8 +46,17 @@
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<layout class="QHBoxLayout" name="titleBarFrameHLayout">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
@ -59,7 +77,7 @@
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/user/friends24.png</pixmap>
<pixmap resource="../icons.qrc">:/icons/png/people.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
@ -99,7 +117,7 @@
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<iconset resource="../icons.qrc">
<normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset>
</property>
<property name="checkable">
@ -114,12 +132,12 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QSplitter" name="splitter">
<widget class="QSplitter" name="mainSplitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout_5">
<layout class="QVBoxLayout" name="leftVLayout">
<item>
<widget class="QFrame" name="toolBarFrame">
<property name="frameShape">
@ -128,20 +146,26 @@
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<layout class="QHBoxLayout" name="toolBarFrameHLayout">
<property name="leftMargin">
<number>1</number>
</property>
<property name="topMargin">
<number>1</number>
</property>
<property name="rightMargin">
<number>1</number>
</property>
<property name="bottomMargin">
<number>1</number>
</property>
<item>
<widget class="LineEditClear" name="filterLineEdit"/>
</item>
<item>
<widget class="QComboBox" name="filterComboBox"/>
</item>
<item>
<widget class="QToolButton" name="toolButton_NewId">
<widget class="QToolButton" name="toolButton_New">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -150,46 +174,11 @@
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Create new Identity</string>
</property>
<property name="text">
<string>New ID</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/identity/identity_create_32.png</normaloff>:/images/identity/identity_create_32.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_NewCircle">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Create new circle</string>
</property>
<property name="text">
<string>New ID</string>
<string>Create new...</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/circles_new_128.png</normaloff>:/icons/circles_new_128.png</iconset>
<normaloff>:/icons/png/add.png</normaloff>:/icons/png/add.png</iconset>
</property>
<property name="iconSize">
<size>
@ -197,6 +186,9 @@
<height>24</height>
</size>
</property>
<property name="popupMode">
<enum>QToolButton::InstantPopup</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
@ -205,9 +197,6 @@
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="filterLayout"/>
</item>
<item>
<widget class="RSTreeWidget" name="idTreeWidget">
<property name="sizePolicy">
@ -257,288 +246,299 @@
<string>Reputation</string>
</property>
<property name="textAlignment">
<set>AlignLeft|AlignVCenter</set>
<set>AlignLeading|AlignVCenter</set>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<widget class="QTabWidget" name="tabWidget1">
<widget class="QTabWidget" name="rightTabWidget">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab_2">
<widget class="QWidget" name="personTab">
<attribute name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/no_avatar_background.png</normaloff>:/images/no_avatar_background.png</iconset>
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/person.png</normaloff>:/icons/png/person.png</iconset>
</attribute>
<attribute name="title">
<string>Person</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="personTabVLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QFrame" name="headerFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<property name="horizontalSpacing">
<number>12</number>
<widget class="QFrame" name="headerFramePerson">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<property name="horizontalSpacing">
<number>12</number>
</property>
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="avLabel_Person">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="avlabel">
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1" rowspan="2" colspan="2">
<widget class="StyledElidedLabel" name="headerTextLabel_Person">
<property name="text">
<string>People</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="detailsGroupBox">
<property name="title">
<string>Identity info</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_Nickname">
<property name="text">
<string>Identity name :</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_Nickname">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2" rowspan="10">
<layout class="QVBoxLayout" name="detailAvatarVLayout">
<item>
<widget class="QLabel" name="avatarLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
<width>128</width>
<height>128</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
<width>128</width>
<height>128</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string/>
<string extracomment="Click here to change your avatar">Your Avatar</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1" rowspan="2" colspan="2">
<widget class="StyledElidedLabel" name="headerTextLabel">
<property name="text">
<string>People</string>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="detailsGroupBox">
<property name="title">
<string>Identity info</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>6</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Identity ID :</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Identity name :</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="PgpId_LB">
<property name="text">
<string>Owner node ID :</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_Nickname">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_KeyId">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="lineEdit_GpgId">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="PgpName_LB">
<property name="text">
<string>Owner node name :</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="lineEdit_GpgName">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEdit_Type"/>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Last used:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="lineEdit_LastUsed"/>
</item>
</layout>
</item>
<item row="0" column="1">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="avatarLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>128</width>
<height>128</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>128</width>
<height>128</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string extracomment="Click here to change your avatar">Your Avatar</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="inviteButton">
<property name="text">
<string>Send Invite</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>2</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="reputationGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Reputation</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<number>6</number>
<widget class="QPushButton" name="inviteButton">
<property name="text">
<string>Send Invite</string>
</property>
<item row="2" column="1">
<widget class="QLineEdit" name="neighborNodesOpinion_TF">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Average opinion of neighbor nodes about this identity. Negative is bad,&lt;/p&gt;&lt;p&gt;positive is good. Zero is neutral.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Your opinion:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Neighbor nodes:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="ownOpinion_CB">
<property name="toolTip">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
</widget>
</item>
<item>
<spacer name="avatarVSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>2</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_KeyId">
<property name="text">
<string>Identity ID :</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_KeyId">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_Type">
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_Type"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_GpgId">
<property name="text">
<string>Owner node ID :</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEdit_GpgId">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_GpgName">
<property name="text">
<string>Owner node name :</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="lineEdit_GpgName">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_LastUsed">
<property name="text">
<string>Last used:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="lineEdit_LastUsed"/>
</item>
<item row="6" column="0" colspan="2">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="banoption_label">
<property name="text">
<string>Ban-option:</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QCheckBox" name="autoBanIdentities_CB">
<property name="text">
<string>Auto-Ban all identities from this node</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="neighborNodesOpinion_LB">
<property name="text">
<string>Neighbor nodes:</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLineEdit" name="neighborNodesOpinion_TF">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Average opinion of neighbor nodes about this identity. Negative is bad,&lt;/p&gt;&lt;p&gt;positive is good. Zero is neutral.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="overallOpinion_LB">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Overall:</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QLineEdit" name="overallOpinion_TF">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Overall reputation score, accounting for yours and your friends'.&lt;/p&gt;&lt;p&gt;Negative is bad, positive is good. Zero is neutral. If the score is too low,&lt;/p&gt;&lt;p&gt;the identity is flagged as bad, and will be filtered out in forums, chat lobbies,&lt;/p&gt;&lt;p&gt;channels, etc.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QComboBox" name="ownOpinion_CB">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
@ -546,97 +546,91 @@ p, li { white-space: pre-wrap; }
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;The overall score is used in chat lobbies, forums and channels to decide on the actions to take for each specific identity. When the overall score is lower than -0.6, the identity is banned, which prevents all messages and forums/channels authored by this identity to be forwarded, both ways. Some forums also have special anti-spam flags that require a higher reputation level, making them more sensitive to bad opinions. Banned identities gradually lose their activity and eventually disappear (after 30 days). &lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>Negative</string>
</property>
<property name="icon">
<iconset>
<normaloff>../icons/yellow_biohazard64.png</normaloff>../icons/yellow_biohazard64.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Neutral</string>
</property>
</item>
<item>
<property name="text">
<string>Positive</string>
</property>
</item>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="overallOpinion_TF">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Overall reputation score, accounting for yours and your friends'.&lt;/p&gt;&lt;p&gt;Negative is bad, positive is good. Zero is neutral. If the score is too low,&lt;/p&gt;&lt;p&gt;the identity is flagged as bad, and will be filtered out in forums, chat lobbies,&lt;/p&gt;&lt;p&gt;channels, etc.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Overall:</string>
</property>
</widget>
</item>
</layout>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<item>
<property name="text">
<string>Negative</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/thumbs-down.png</normaloff>:/icons/png/thumbs-down.png</iconset>
</property>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
<item>
<property name="text">
<string>Neutral</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/thumbs-neutral.png</normaloff>:/icons/png/thumbs-neutral.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Positive</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/thumbs-up.png</normaloff>:/icons/png/thumbs-up.png</iconset>
</property>
</item>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Your opinion:</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="reputationVSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab">
<widget class="QWidget" name="circleTab">
<attribute name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/circles/circles_64.png</normaloff>:/images/circles/circles_64.png</iconset>
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/circles.png</normaloff>:/icons/png/circles.png</iconset>
</attribute>
<attribute name="title">
<string>Circles</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_6">
<layout class="QVBoxLayout" name="circleTabVLayout">
<item>
<widget class="QFrame" name="headerFrame_2">
<widget class="QFrame" name="headerFrameCircle">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<layout class="QGridLayout" name="headerFrameCircleGLayout">
<property name="horizontalSpacing">
<number>12</number>
</property>
@ -746,6 +740,16 @@ p, li { white-space: pre-wrap; }
</action>
</widget>
<customwidgets>
<customwidget>
<class>LineEditClear</class>
<extends>QLineEdit</extends>
<header location="global">gui/common/LineEditClear.h</header>
</customwidget>
<customwidget>
<class>RSTreeWidget</class>
<extends>QTreeWidget</extends>
<header>gui/common/RSTreeWidget.h</header>
</customwidget>
<customwidget>
<class>StyledElidedLabel</class>
<extends>QLabel</extends>
@ -756,23 +760,13 @@ p, li { white-space: pre-wrap; }
<extends>QLabel</extends>
<header>gui/common/StyledLabel.h</header>
</customwidget>
<customwidget>
<class>RSTreeWidget</class>
<extends>QTreeWidget</extends>
<header>gui/common/RSTreeWidget.h</header>
</customwidget>
<customwidget>
<class>LineEditClear</class>
<extends>QLineEdit</extends>
<header location="global">gui/common/LineEditClear.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>idTreeWidget</tabstop>
</tabstops>
<resources>
<include location="../images.qrc"/>
<include location="../icons.qrc"/>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -49,7 +49,7 @@ IdEditDialog::IdEditDialog(QWidget *parent) :
ui->setupUi(this);
ui->headerFrame->setHeaderImage(QPixmap(":/images/identity/identity_create_64.png"));
ui->headerFrame->setHeaderImage(QPixmap(":/icons/png/person.png"));
ui->headerFrame->setHeaderText(tr("Create New Identity"));
/* Setup UI helper */
@ -202,7 +202,7 @@ void IdEditDialog::setAvatar(const QPixmap &avatar)
void IdEditDialog::setupExistingId(const RsGxsGroupId &keyId)
{
setWindowTitle(tr("Edit identity"));
ui->headerFrame->setHeaderImage(QPixmap(":/images/identity/identity_edit_64.png"));
ui->headerFrame->setHeaderImage(QPixmap(":/icons/png/person.png"));
ui->headerFrame->setHeaderText(tr("Edit identity"));
mIsNew = false;
@ -505,17 +505,17 @@ void IdEditDialog::createId()
{
QString groupname = ui->lineEdit_Nickname->text();
if (groupname.size() < 2)
if (groupname.size() < RSID_MINIMUM_NICKNAME_SIZE)
{
std::cerr << "IdEditDialog::createId() Nickname too short";
std::cerr << "IdEditDialog::createId() Nickname too short (min " << RSID_MINIMUM_NICKNAME_SIZE << " chars)";
std::cerr << std::endl;
QMessageBox::warning(this, "", tr("The nickname is too short. Please input at least %1 characters.").arg(2), QMessageBox::Ok, QMessageBox::Ok);
QMessageBox::warning(this, "", tr("The nickname is too short. Please input at least %1 characters.").arg(RSID_MINIMUM_NICKNAME_SIZE), QMessageBox::Ok, QMessageBox::Ok);
return;
}
if (groupname.size() > RSID_MAXIMUM_NICKNAME_SIZE)
{
std::cerr << "IdEditDialog::createId() Nickname too long (max " << RSID_MAXIMUM_NICKNAME_SIZE<< " chars)";
std::cerr << "IdEditDialog::createId() Nickname too long (max " << RSID_MAXIMUM_NICKNAME_SIZE << " chars)";
std::cerr << std::endl;
QMessageBox::warning(this, "", tr("The nickname is too long. Please reduce the length to %1 characters.").arg(RSID_MAXIMUM_NICKNAME_SIZE), QMessageBox::Ok, QMessageBox::Ok);

View file

@ -115,26 +115,16 @@
#include <iomanip>
#include <unistd.h>
#define IMAGE_QUIT ":/icons/quit_128.png"
#define IMAGE_PREFERENCES ":/icons/system_128.png"
#define IMAGE_ABOUT ":/icons/information_128.png"
#define IMAGE_ADDFRIEND ":/icons/add_user_256.png"
#define IMAGE_QUIT ":/icons/png/exit.png"
#define IMAGE_PREFERENCES ":/icons/png/options.png"
#define IMAGE_ABOUT ":/icons/png/info.png"
#define IMAGE_ADDFRIEND ":/icons/png/invite.png"
#define IMAGE_RETROSHARE ":/icons/logo_128.png"
#define IMAGE_NOONLINE ":/icons/logo_0_connected_128.png"
#define IMAGE_ONEONLINE ":/icons/logo_1_connected_128.png"
#define IMAGE_TWOONLINE ":/icons/logo_2_connected_128.png"
#define IMAGE_OVERLAY ":/icons/star_overlay_128.png"
/* Images for toolbar icons */
//#define IMAGE_NETWORK2 ":/images/rs1.png"
//#define IMAGE_PEERS ":/images/groupchat.png"
//#define IMAGE_TRANSFERS ":/images/ktorrent32.png"
//#define IMAGE_FILES ":/images/fileshare32.png"
//#define IMAGE_CHANNELS ":/images/channels.png"
//#define IMAGE_FORUMS ":/images/konversation.png"
//#define IMAGE_CHAT ":/images/groupchat.png"
//#define IMAGE_STATISTIC ":/images/utilities-system-monitor.png"
//#define IMAGE_MESSAGES ":/images/evolution.png"
#define IMAGE_BWGRAPH ":/images/ksysguard.png"
#define IMAGE_MESSENGER ":/images/rsmessenger48.png"
#define IMAGE_CLOSE ":/images/close_normal.png"
@ -148,16 +138,10 @@
#define IMAGE_UNFINISHED ":/images/underconstruction.png"
#define IMAGE_MINIMIZE ":/images/window_nofullscreen.png"
#define IMAGE_MAXIMIZE ":/images/window_fullscreen.png"
//#define IMG_HELP ":/images/help24.png"
//#define IMAGE_NEWSFEED ":/images/newsfeed/news-feed-32.png"
#define IMAGE_PLUGINS ":/images/extension_32.png"
#define IMAGE_BLOGS ":/images/kblogger.png"
#define IMAGE_DHT ":/images/dht16.png"
//#define IMAGE_CHATLOBBY ":/images/chat_32.png"
//#define IMAGE_GXSCHANNELS ":/images/channels.png"
//#define IMAGE_GXSFORUMS ":/images/konversation.png"
//#define IMAGE_IDENTITY ":/images/identity/identities_32.png"
//#define IMAGE_CIRCLES ":/images/circles/circles_32.png"
/*static*/ MainWindow *MainWindow::_instance = NULL;
@ -420,6 +404,7 @@ void MainWindow::initStackedPage()
#endif
#endif
#undef GETSTARTED_GUI
#ifdef GETSTARTED_GUI
MainPage *getStartedPage = NULL;
@ -562,7 +547,9 @@ void MainWindow::createTrayIcon()
trayMenu->addSeparator();
trayMenu->addAction(QIcon(IMAGE_MESSENGER), tr("Open Messenger"), this, SLOT(showMessengerWindow()));
trayMenu->addAction(QIcon(IMAGE_MESSAGES), tr("Open Messages"), this, SLOT(showMess()));
#ifdef ENABLE_WEBUI
trayMenu->addAction(QIcon(":/images/emblem-web.png"), tr("Show web interface"), this, SLOT(showWebinterface()));
#endif // ENABLE_WEBUI
trayMenu->addAction(QIcon(IMAGE_BWGRAPH), tr("Bandwidth Graph"), _bandwidthGraph, SLOT(showWindow()));
trayMenu->addAction(QIcon(IMAGE_DHT), tr("Statistics"), this, SLOT(showStatisticsWindow()));
@ -1061,10 +1048,12 @@ void MainWindow::showStatisticsWindow()
StatisticsWindow::showYourself();
}
#ifdef ENABLE_WEBUI
void MainWindow::showWebinterface()
{
WebuiPage::showWebui();
}
#endif // ENABLE_WEBUI
/** Shows Application window */
#ifdef UNFINISHED
@ -1406,7 +1395,14 @@ void MainWindow::externalLinkActivated(const QUrl &url)
QMessageBox mb(QObject::tr("Confirmation"), QObject::tr("Do you want this link to be handled by your system?")+"<br/><br/>"+ url.toString()+"<br/><br/>"+tr("Make sure this link has not been forged to drag you to a malicious website."), QMessageBox::Question, QMessageBox::Yes,QMessageBox::No, 0);
QCheckBox *checkbox = new QCheckBox(tr("Don't ask me again")) ;
mb.layout()->addWidget(checkbox) ;
QGridLayout* layout = qobject_cast<QGridLayout*>(mb.layout());
if (layout)
{
layout->addWidget(checkbox,layout->rowCount(),0,1, layout->columnCount(), Qt::AlignLeft);
} else {
//Not QGridLayout so add at end
mb.layout()->addWidget(checkbox) ;
}
int res = mb.exec() ;

View file

@ -211,7 +211,9 @@ private slots:
void newRsCollection();
void showMessengerWindow();
void showStatisticsWindow();
#ifdef ENABLE_WEBUI
void showWebinterface();
#endif
//void servicePermission();
#ifdef UNFINISHED

View file

@ -27,7 +27,7 @@
#include "mainpage.h"
#include "ui_MessagesDialog.h"
#define IMAGE_MESSAGES ":/images/evolution.png"
#define IMAGE_MESSAGES ":/icons/png/messages.png"
class RSTreeWidgetItemCompareRole;
class MessageWidget;

View file

@ -11,7 +11,16 @@
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@ -41,7 +50,16 @@
<enum>QFrame::Sunken</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<property name="horizontalSpacing">
@ -306,7 +324,7 @@
<string/>
</property>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/evolution.png</pixmap>
<pixmap resource="icons.qrc">:/icons/png/messages.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
@ -496,7 +514,16 @@
<string notr="true">Main Tab</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
@ -509,15 +536,24 @@
</property>
<widget class="QFrame" name="sideBarFrame">
<layout class="QGridLayout" name="gridLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item row="1" column="0">
<widget class="QListWidget" name="listWidget">
<property name="sizePolicy">
@ -830,6 +866,7 @@
</tabstops>
<resources>
<include location="images.qrc"/>
<include location="icons.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -56,8 +56,9 @@
*****/
MessengerWindow* MessengerWindow::_instance = NULL;
static std::set<std::string> *expandedPeers = NULL;
static std::set<std::string> *expandedGroups = NULL;
std::set<std::string> MessengerWindow::expandedPeers ;
std::set<RsNodeGroupId> MessengerWindow::expandedGroups ;
/*static*/ void MessengerWindow::showYourself ()
{
@ -79,16 +80,6 @@ void MessengerWindow::releaseInstance()
if (_instance) {
delete _instance;
}
if (expandedPeers) {
/* delete saved expanded peers */
delete(expandedPeers);
expandedPeers = NULL;
}
if (expandedGroups) {
/* delete saved expanded groups */
delete(expandedGroups);
expandedGroups = NULL;
}
}
/** Constructor */
@ -108,21 +99,15 @@ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WindowFlags flags)
connect(NotifyQt::getInstance(), SIGNAL(ownStatusMessageChanged()), this, SLOT(loadmystatusmessage()));
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateOwnStatus(QString,int)));
if (expandedPeers != NULL) {
for (std::set<std::string>::iterator peerIt = expandedPeers->begin(); peerIt != expandedPeers->end(); ++peerIt) {
for (std::set<std::string>::iterator peerIt = expandedPeers.begin(); peerIt != expandedPeers.end(); ++peerIt) {
ui.friendList->addPeerToExpand(*peerIt);
}
delete expandedPeers;
expandedPeers = NULL;
}
expandedPeers.clear();
if (expandedGroups != NULL) {
for (std::set<std::string>::iterator groupIt = expandedGroups->begin(); groupIt != expandedGroups->end(); ++groupIt) {
for (std::set<RsNodeGroupId>::iterator groupIt = expandedGroups.begin(); groupIt != expandedGroups.end(); ++groupIt) {
ui.friendList->addGroupToExpand(*groupIt);
}
delete expandedGroups;
expandedGroups = NULL;
}
expandedGroups.clear();
ui.messagelineEdit->setMinimumWidth(20);
@ -203,22 +188,12 @@ void MessengerWindow::addFriend()
void MessengerWindow::closeEvent (QCloseEvent * /*event*/)
{
/* save the expanded peers */
if (expandedPeers == NULL) {
expandedPeers = new std::set<std::string>;
} else {
expandedPeers->clear();
}
ui.friendList->getExpandedPeers(*expandedPeers);
expandedPeers.clear();
ui.friendList->getExpandedPeers(expandedPeers);
/* save the expanded groups */
if (expandedGroups == NULL) {
expandedGroups = new std::set<std::string>;
} else {
expandedGroups->clear();
}
ui.friendList->getExpandedGroups(*expandedGroups);
expandedGroups.clear();
ui.friendList->getExpandedGroups(expandedGroups);
}
/** Shows Share Manager */

View file

@ -66,6 +66,9 @@ private:
/** Qt Designer generated object */
Ui::MessengerWindow ui;
static std::set<std::string> expandedPeers ;
static std::set<RsNodeGroupId> expandedGroups ;
};
#endif

View file

@ -11,7 +11,16 @@
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@ -29,19 +38,28 @@
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="titleBarPixmap">
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="pixmap">
<pixmap resource="icons.qrc">:/icons/knews_128.png</pixmap>
<pixmap resource="icons.qrc">:/icons/png/newsfeed.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>

View file

@ -20,6 +20,7 @@
****************************************************************/
#include "PluginManagerWidget.h"
#include "gui/settings/rsharesettings.h"
#include <QHBoxLayout>
#include <QVBoxLayout>
@ -160,14 +161,10 @@ PluginManagerWidget::registerNewPlugin(QString pluginName)
void
PluginManagerWidget::installPluginButtonClicked()
{
QString fileName = QFileDialog::getOpenFileName(this,
tr("Open Plugin to install"),
"./",
tr("Plugins (*.so *.dll)"));
QString fileName = misc::getOpenFileName(this, RshareSettings::LASTDIR_PLUGIN, tr("Open Plugin to install"), "./", tr("Plugins (*.so *.dll)"));
if (!fileName.isNull())
{
emit installPluginRequested(fileName);
}
}
//=============================================================================

View file

@ -101,9 +101,9 @@ QString PostedDialog::icon(IconType type)
{
switch (type) {
case ICON_NAME:
return ":/images/posted_24.png";
return ":/icons/png/posted.png";
case ICON_NEW:
return ":/images/posted_add_24.png";
return ":/icons/png/add.png";
case ICON_YOUR_GROUP:
return ":/images/folder16.png";
case ICON_SUBSCRIBED_GROUP:

View file

@ -26,7 +26,7 @@
#include "gui/gxs/GxsGroupFrameDialog.h"
#define IMAGE_POSTED ":/images/posted_32.png"
#define IMAGE_POSTED ":/icons/png/posted.png"
class PostedDialog : public GxsGroupFrameDialog
{

View file

@ -90,7 +90,7 @@ void PostedGroupDialog::initUi()
QPixmap PostedGroupDialog::serviceImage()
{
return QPixmap(":/images/posted_add_64.png");
return QPixmap(":/icons/png/posted.png");
}
bool PostedGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta)

View file

@ -44,6 +44,7 @@ PostedItem::PostedItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroup
requestGroup();
requestMessage();
requestComment();
}
PostedItem::PostedItem(FeedHolder *feedHolder, uint32_t feedId, const RsPostedGroup &group, const RsPostedPost &post, bool isHome, bool autoUpdate) :
@ -53,6 +54,7 @@ PostedItem::PostedItem(FeedHolder *feedHolder, uint32_t feedId, const RsPostedGr
setGroup(group, false);
setPost(post);
requestComment();
}
PostedItem::PostedItem(FeedHolder *feedHolder, uint32_t feedId, const RsPostedPost &post, bool isHome, bool autoUpdate) :
@ -62,6 +64,7 @@ PostedItem::PostedItem(FeedHolder *feedHolder, uint32_t feedId, const RsPostedPo
requestGroup();
setPost(post);
requestComment();
}
PostedItem::~PostedItem()
@ -84,6 +87,8 @@ void PostedItem::setup()
ui->dateLabel->clear();
ui->fromLabel->clear();
ui->siteLabel->clear();
ui->newCommentLabel->hide();
ui->commLabel->hide();
/* general ones */
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(removeItem()));
@ -160,21 +165,57 @@ void PostedItem::loadGroup(const uint32_t &token)
void PostedItem::loadMessage(const uint32_t &token)
{
std::vector<RsPostedPost> posts;
if (!rsPosted->getPostData(token, posts))
std::vector<RsGxsComment> cmts;
if (!rsPosted->getPostData(token, posts, cmts))
{
std::cerr << "GxsChannelPostItem::loadMessage() ERROR getting data";
std::cerr << std::endl;
return;
}
if (posts.size() != 1)
if (posts.size() == 1)
{
std::cerr << "GxsChannelPostItem::loadMessage() Wrong number of Items";
setPost(posts[0]);
}
else if (cmts.size() == 1)
{
RsGxsComment cmt = cmts[0];
ui->newCommentLabel->show();
ui->commLabel->show();
ui->commLabel->setText(QString::fromUtf8(cmt.mComment.c_str()));
//Change this item to be uploaded with thread element.
setMessageId(cmt.mMeta.mThreadId);
requestMessage();
}
else
{
std::cerr << "GxsChannelPostItem::loadMessage() Wrong number of Items. Remove It.";
std::cerr << std::endl;
removeItem();
return;
}
}
void PostedItem::loadComment(const uint32_t &token)
{
std::vector<RsGxsComment> cmts;
if (!rsPosted->getRelatedComments(token, cmts))
{
std::cerr << "GxsChannelPostItem::loadComment() ERROR getting data";
std::cerr << std::endl;
return;
}
setPost(posts[0]);
size_t comNb = cmts.size();
QString sComButText = tr("Comment");
if (comNb == 1) {
sComButText = sComButText.append("(1)");
} else if (comNb > 1) {
sComButText = tr("Comments").append("(%1)").arg(comNb);
}
ui->commentButton->setText(sComButText);
}
void PostedItem::fill()
@ -390,15 +431,15 @@ void PostedItem::setReadStatus(bool isNew, bool isUnread)
ui->newLabel->setVisible(isNew);
/* unpolish widget to clear the stylesheet's palette cache */
ui->frame->style()->unpolish(ui->frame);
ui->mainFrame->style()->unpolish(ui->mainFrame);
QPalette palette = ui->frame->palette();
palette.setColor(ui->frame->backgroundRole(), isNew ? COLOR_NEW : COLOR_NORMAL); // QScrollArea
QPalette palette = ui->mainFrame->palette();
palette.setColor(ui->mainFrame->backgroundRole(), isNew ? COLOR_NEW : COLOR_NORMAL); // QScrollArea
palette.setColor(QPalette::Base, isNew ? COLOR_NEW : COLOR_NORMAL); // QTreeWidget
ui->frame->setPalette(palette);
ui->mainFrame->setPalette(palette);
ui->frame->setProperty("new", isNew);
Rshare::refreshStyleSheet(ui->frame, false);
ui->mainFrame->setProperty("new", isNew);
Rshare::refreshStyleSheet(ui->mainFrame, false);
}
void PostedItem::readToggled(bool checked)

View file

@ -72,8 +72,9 @@ protected:
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_UNKNOWN; }
/* GxsFeedItem */
virtual void loadMessage(const uint32_t &token);
virtual QString messageName();
virtual void loadMessage(const uint32_t &token);
virtual void loadComment(const uint32_t &token);
private:
void setup();

View file

@ -13,9 +13,9 @@
<property name="windowTitle">
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="PostedItemVLayout">
<item>
<widget class="QFrame" name="frame">
<widget class="QFrame" name="mainFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -31,7 +31,7 @@
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="mainFrameVLayout">
<item>
<widget class="StyledLabel" name="titleLabel">
<property name="sizePolicy">
@ -59,9 +59,33 @@
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="newCommHLayout">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="newCommentLabel">
<property name="text">
<string>New Comment:</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="ElidedLabel" name="commLabel">
<property name="text">
<string>Comment Value</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<layout class="QHBoxLayout" name="buttonHLayout">
<item>
<widget class="StyledLabel" name="scoreLabel">
<property name="text">
@ -207,7 +231,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="fromBoldLabel_2">
<widget class="QLabel" name="siteBoldLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -297,21 +321,7 @@
</layout>
</item>
</layout>
<zorder>readAndClearButton</zorder>
<zorder>dateBoldLabel</zorder>
<zorder>dateLabel</zorder>
<zorder>fromBoldLabel</zorder>
<zorder>commentButton</zorder>
<zorder>newLabel</zorder>
<zorder>siteLabel</zorder>
<zorder>fromLabel</zorder>
<zorder>readButton</zorder>
<zorder>fromBoldLabel_2</zorder>
<zorder>clearButton</zorder>
<zorder>titleLabel</zorder>
<zorder>voteDownButton</zorder>
<zorder>voteUpButton</zorder>
<zorder>scoreLabel</zorder>
<zorder></zorder>
</widget>
</item>
@ -357,6 +367,12 @@
<extends>QLabel</extends>
<header>gui/gxs/GxsIdLabel.h</header>
</customwidget>
<customwidget>
<class>ElidedLabel</class>
<extends>QLabel</extends>
<header location="global">gui/common/ElidedLabel.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>

View file

@ -37,12 +37,12 @@ bool PostedUserNotify::hasSetting(QString *name, QString *group)
QIcon PostedUserNotify::getIcon()
{
return QIcon(":/icons/posted_128.png");
return QIcon(":/icons/png/posted.png");
}
QIcon PostedUserNotify::getMainIcon(bool hasNew)
{
return hasNew ? QIcon(":/icons/posted_red_128.png") : QIcon(":/icons/posted_128.png");
return hasNew ? QIcon(":/icons/png/posted-notify.png") : QIcon(":/icons/png/posted.png");
}
void PostedUserNotify::iconClicked()

View file

@ -211,12 +211,12 @@ QString RetroshareDirModel::getFlagsString(FileStorageFlags flags)
return QString(str) ;
}
QString RetroshareDirModel::getGroupsString(const std::list<std::string>& group_ids)
QString RetroshareDirModel::getGroupsString(const std::list<RsNodeGroupId>& group_ids)
{
QString groups_str ;
RsGroupInfo group_info ;
for(std::list<std::string>::const_iterator it(group_ids.begin());it!=group_ids.end();)
for(std::list<RsNodeGroupId>::const_iterator it(group_ids.begin());it!=group_ids.end();)
if(rsPeers->getGroupInfo(*it,group_info))
{
groups_str += GroupDefs::name(group_info) ;

View file

@ -92,7 +92,7 @@ class RetroshareDirModel : public QAbstractItemModel
void treeStyle();
void downloadDirectory(const DirDetails & details, int prefixLen);
static QString getFlagsString(FileStorageFlags f) ;
static QString getGroupsString(const std::list<std::string>&) ;
static QString getGroupsString(const std::list<RsNodeGroupId> &) ;
QString getAgeIndicatorString(const DirDetails &) const;
// void getAgeIndicatorRec(const DirDetails &details, QString &ret) const;

View file

@ -249,7 +249,7 @@ void ShareManager::updateGroups()
QString group_string;
int n = 0;
for (std::list<std::string>::const_iterator it2((*it).parent_groups.begin());it2!=(*it).parent_groups.end();++it2,++n)
for (std::list<RsNodeGroupId>::const_iterator it2((*it).parent_groups.begin());it2!=(*it).parent_groups.end();++it2,++n)
{
if (n>0)
group_string += ", " ;

View file

@ -67,7 +67,7 @@
#define IMAGE_COLLVIEW ":/images/library_view.png"
#define IMAGE_COLLOPEN ":/images/library.png"
#define IMAGE_EDITSHARE ":/images/edit_16.png"
#define IMAGE_MYFILES ":images/my_documents_22.png"
#define IMAGE_MYFILES ":/icons/svg/folders1.svg"
/*define dirTreeView Column */
#define COLUMN_NAME 0

View file

@ -29,7 +29,16 @@
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
@ -44,7 +53,7 @@
<string/>
</property>
<property name="pixmap">
<pixmap resource="images.qrc">:/images/fileshare24.png</pixmap>
<pixmap resource="icons.qrc">:/icons/svg/folders.svg</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
@ -294,7 +303,16 @@ border-image: url(:/images/closepressed.png)
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
@ -346,6 +364,7 @@ border-image: url(:/images/closepressed.png)
</customwidgets>
<resources>
<include location="images.qrc"/>
<include location="icons.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -76,6 +76,8 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
connect(ui.participantsList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(participantsTreeWidgetCustomPopupMenu(QPoint)));
connect(ui.participantsList, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(participantsTreeWidgetDoubleClicked(QTreeWidgetItem*,int)));
connect(ui.filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
int S = QFontMetricsF(font()).height() ;
ui.participantsList->setIconSize(QSize(1.3*S,1.3*S));
@ -108,12 +110,17 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
connect(actionSortByName, SIGNAL(triggered()), this, SLOT(sortParcipants()));
connect(actionSortByActivity, SIGNAL(triggered()), this, SLOT(sortParcipants()));
/* Add filter actions */
QTreeWidgetItem *headerItem = ui.participantsList->headerItem();
QString headerText = headerItem->text(COLUMN_NAME );
ui.filterLineEdit->addFilter(QIcon(), headerText, COLUMN_NAME , QString("%1 %2").arg(tr("Search"), headerText));
// Add a button to invite friends.
//
inviteFriendsButton = new QToolButton ;
inviteFriendsButton->setMinimumSize(QSize(2*S,2*S)) ;
inviteFriendsButton->setMaximumSize(QSize(2*S,2*S)) ;
inviteFriendsButton->setMinimumSize(QSize(2.4*S,2.4*S)) ;
inviteFriendsButton->setMaximumSize(QSize(2.4*S,2.4*S)) ;
inviteFriendsButton->setText(QString()) ;
inviteFriendsButton->setAutoRaise(true) ;
inviteFriendsButton->setToolTip(tr("Invite friends to this lobby"));
@ -123,9 +130,9 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
{
QIcon icon ;
icon.addPixmap(QPixmap(":/images/user/add_user24.png")) ;
icon.addPixmap(QPixmap(":/icons/png/invite.png")) ;
inviteFriendsButton->setIcon(icon) ;
inviteFriendsButton->setIconSize(QSize(2*S,2*S)) ;
inviteFriendsButton->setIconSize(QSize(2.4*S,2.4*S)) ;
}
connect(inviteFriendsButton, SIGNAL(clicked()), this , SLOT(inviteFriends()));
@ -135,8 +142,15 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
RsGxsId current_id;
rsMsgs->getIdentityForChatLobby(lobbyId, current_id);
uint32_t idChooserFlag = IDCHOOSER_ID_REQUIRED;
ChatLobbyInfo lobbyInfo ;
if(rsMsgs->getChatLobbyInfo(lobbyId,lobbyInfo)) {
if (lobbyInfo.lobby_flags & RS_CHAT_LOBBY_FLAGS_PGP_SIGNED) {
idChooserFlag |= IDCHOOSER_NON_ANONYMOUS;
}
}
ownIdChooser = new GxsIdChooser() ;
ownIdChooser->loadIds(IDCHOOSER_ID_REQUIRED,current_id) ;
ownIdChooser->loadIds(idChooserFlag, current_id) ;
QWidgetAction *checkableAction = new QWidgetAction(this);
checkableAction->setDefaultWidget(ownIdChooser);
@ -149,17 +163,17 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
connect(ownIdChooser,SIGNAL(currentIndexChanged(int)),this,SLOT(changeNickname())) ;
unsubscribeButton = new QToolButton ;
unsubscribeButton->setMinimumSize(QSize(2*S,2*S)) ;
unsubscribeButton->setMaximumSize(QSize(2*S,2*S)) ;
unsubscribeButton->setMinimumSize(QSize(2.4*S,2.4*S)) ;
unsubscribeButton->setMaximumSize(QSize(2.4*S,2.4*S)) ;
unsubscribeButton->setText(QString()) ;
unsubscribeButton->setAutoRaise(true) ;
unsubscribeButton->setToolTip(tr("Leave this lobby (Unsubscribe)"));
{
QIcon icon ;
icon.addPixmap(QPixmap(":/images/door_in.png")) ;
icon.addPixmap(QPixmap(":/icons/png/leave.png")) ;
unsubscribeButton->setIcon(icon) ;
unsubscribeButton->setIconSize(QSize(2*S,2*S)) ;
unsubscribeButton->setIconSize(QSize(2.4*S,2.4*S)) ;
}
/* Initialize splitter */
@ -281,8 +295,6 @@ void ChatLobbyDialog::init()
QString title;
std::list<ChatLobbyInfo>::const_iterator lobbyIt;
if(rsMsgs->getChatLobbyInfo(lobbyId,linfo))
{
title = QString::fromUtf8(linfo.lobby_name.c_str());
@ -552,6 +564,7 @@ void ChatLobbyDialog::updateParticipantsList()
}
ui.participantsList->setSortingEnabled(true);
sortParcipants();
filterIds();
}
/**
@ -852,3 +865,16 @@ void ChatLobbyDialog::sortParcipants()
}
}
void ChatLobbyDialog::filterChanged(const QString& /*text*/)
{
filterIds();
}
void ChatLobbyDialog::filterIds()
{
int filterColumn = ui.filterLineEdit->currentFilter();
QString text = ui.filterLineEdit->text();
ui.participantsList->filterItems(filterColumn, text);
}

View file

@ -53,6 +53,7 @@ private slots:
void participantsTreeWidgetCustomPopupMenu( QPoint point );
void inviteFriends() ;
void leaveLobby() ;
void filterChanged(const QString &text);
signals:
void lobbyLeave(ChatLobbyId) ;
@ -83,6 +84,8 @@ protected slots:
private:
void updateParticipantsList();
void filterIds();
QString getParticipantName(const RsGxsId& id) const;
void muteParticipant(const RsGxsId& id);

View file

@ -14,7 +14,16 @@
<string notr="true">MainWindow</string>
</property>
<layout class="QHBoxLayout" name="ChatLobbyDialogHLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@ -57,16 +66,43 @@
<number>0</number>
</property>
<property name="topMargin">
<number>3</number>
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>3</number>
<number>0</number>
</property>
<item>
<widget class="QTreeWidget" name="participantsList">
<widget class="QFrame" name="toolBarFrame">
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="toolBarFrameHLayout">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="LineEditClear" name="filterLineEdit"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="RSTreeWidget" name="participantsList">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
@ -114,6 +150,11 @@
<string>Participants</string>
</property>
</column>
<column>
<property name="text">
<string>Name</string>
</property>
</column>
</widget>
</item>
</layout>
@ -128,13 +169,26 @@
</action>
</widget>
<customwidgets>
<customwidget>
<class>LineEditClear</class>
<extends>QLineEdit</extends>
<header location="global">gui/common/LineEditClear.h</header>
</customwidget>
<customwidget>
<class>ChatWidget</class>
<extends>QWidget</extends>
<header location="global">gui/chat/ChatWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>RSTreeWidget</class>
<extends>QTreeWidget</extends>
<header>gui/common/RSTreeWidget.h</header>
</customwidget>
</customwidgets>
<resources/>
<resources>
<include location="../icons.qrc"/>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -38,8 +38,9 @@ ChatLobbyUserNotify::ChatLobbyUserNotify(QObject *parent) :
_bCheckForNickName = Settings->valueFromGroup(_group, "CheckForNickName", true).toBool();
_bCountUnRead = Settings->valueFromGroup(_group, "CountUnRead", true).toBool();
_bCountSpecificText = Settings->valueFromGroup(_group, "CountSpecificText").toBool();
_textToNotify = Settings->valueFromGroup(_group, "TextToNotify").toStringList();
_bCountSpecificText = Settings->valueFromGroup(_group, "CountSpecificText", false).toBool();
_textToNotify = Settings->valueFromGroup(_group, "TextToNotify").toStringList();
_bTextCaseSensitive = Settings->valueFromGroup(_group, "TextCaseSensitive", false).toBool();
}
bool ChatLobbyUserNotify::hasSetting(QString *name, QString *group)
@ -88,14 +89,22 @@ void ChatLobbyUserNotify::setTextToNotify(QString value)
setTextToNotify(list);
}
void ChatLobbyUserNotify::setTextCaseSensitive(bool value)
{
if (_bTextCaseSensitive != value) {
_bTextCaseSensitive = value;
Settings->setValueToGroup(_group, "TextCaseSensitive", value);
}
}
QIcon ChatLobbyUserNotify::getIcon()
{
return QIcon(":/images/chat_32.png");
return QIcon(":/icons/png/chat-lobbies.png");
}
QIcon ChatLobbyUserNotify::getMainIcon(bool hasNew)
{
return hasNew ? QIcon(":/icons/chat_red_128.png") : QIcon(":/icons/chat_128.png");
return hasNew ? QIcon(":/icons/png/chat-lobbies-notify.png") : QIcon(":/icons/png/chat-lobbies.png");
}
unsigned int ChatLobbyUserNotify::getNewCount()
@ -249,12 +258,12 @@ void ChatLobbyUserNotify::chatLobbyNewMessage(ChatLobbyId lobby_id, QDateTime ti
bGetNickName = checkWord(msg, QString::fromUtf8(details.mNickname.c_str()));
}
bool bFoundTextToNotify = false;
bool bFoundTextToNotify = false;
if(_bCountSpecificText)
for (QStringList::Iterator it = _textToNotify.begin(); it != _textToNotify.end(); ++it) {
bFoundTextToNotify |= checkWord(msg, (*it));
}
if(_bCountSpecificText)
for (QStringList::Iterator it = _textToNotify.begin(); it != _textToNotify.end(); ++it) {
bFoundTextToNotify |= checkWord(msg, (*it));
}
if ((bGetNickName || bFoundTextToNotify || _bCountUnRead)){
QString strAnchor = time.toString(Qt::ISODate);
@ -272,7 +281,7 @@ bool ChatLobbyUserNotify::checkWord(QString message, QString word)
{
bool bFound = false;
int nFound = -1;
if (((nFound=message.indexOf(word)) != -1)
if (((nFound=message.indexOf(word,0,_bTextCaseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive)) != -1)
&& (!word.isEmpty())) {
QString eow=" ~!@#$%^&*()_+{}|:\"<>?,./;'[]\\-="; // end of word
bool bFirstCharEOW = (nFound==0)?true:(eow.indexOf(message.at(nFound-1)) != -1);

View file

@ -55,11 +55,13 @@ public:
bool isCheckForNickName() { return _bCheckForNickName;}
void setCountUnRead(bool value);
bool isCountUnRead() { return _bCountUnRead;}
void setCountSpecificText(bool value);
bool isCountSpecificText() { return _bCountSpecificText;}
void setTextToNotify(QStringList);
void setCountSpecificText(bool value);
bool isCountSpecificText() { return _bCountSpecificText;}
void setTextToNotify(QStringList);
void setTextToNotify(QString);
QString textToNotify() { return _textToNotify.join("\n");}
void setTextCaseSensitive(bool value);
bool isTextCaseSensitive() {return _bTextCaseSensitive;}
signals:
void countChanged(ChatLobbyId id, unsigned int count);
@ -84,10 +86,12 @@ private:
typedef std::map<QString, MsgData> msg_map;
typedef std::map<ChatLobbyId, msg_map> lobby_map;
lobby_map _listMsg;
QStringList _textToNotify;
bool _bCheckForNickName;
bool _bCountUnRead;
bool _bCountSpecificText;
bool _bCheckForNickName;
bool _bCountSpecificText;
QStringList _textToNotify;
bool _bTextCaseSensitive;
};
#endif // CHATLOBBYUSERNOTIFY_H

View file

@ -79,7 +79,7 @@ QIcon ChatUserNotify::getIcon()
QIcon ChatUserNotify::getMainIcon(bool hasNew)
{
return hasNew ? QIcon(":/icons/logo_128.png") : QIcon(":/icons/logo_128.png");
return hasNew ? QIcon(":/icons/png/network-notify.png") : QIcon(":/icons/png/network.png");
}
unsigned int ChatUserNotify::getNewCount()

View file

@ -62,7 +62,7 @@
#include <time.h>
#define FMM 2//fontMetricsMultiplicator
#define FMM 2.5//fontMetricsMultiplicator
/*****
* #define CHAT_DEBUG 1
@ -91,8 +91,6 @@ ChatWidget::ChatWidget(QWidget *parent) :
//Resize Tool buttons
ui->emoteiconButton->setFixedSize(buttonSize);
ui->emoteiconButton->setIconSize(iconSize);
ui->fontButton->setFixedSize(buttonSize);
ui->fontButton->setIconSize(iconSize);
ui->attachPictureButton->setFixedSize(buttonSize);
ui->attachPictureButton->setIconSize(iconSize);
ui->addFileButton->setFixedSize(buttonSize);
@ -109,7 +107,8 @@ ChatWidget::ChatWidget(QWidget *parent) :
ui->searchButton->setFixedSize(buttonSize);
ui->searchButton->setIconSize(iconSize);
ui->sendButton->setFixedHeight(iconHeight);
ui->sendButton->setIconSize(iconSize);
//Initialize search
iCharToStartSearch=Settings->getChatSearchCharToStartSearch();
bFindCaseSensitively=Settings->getChatSearchCaseSensitively();
@ -121,7 +120,7 @@ ChatWidget::ChatWidget(QWidget *parent) :
ui->actionSearchWithoutLimit->setText(tr("Don't stop to color after")+" "+QString::number(uiMaxSearchLimitColor)+" "+tr("items found (need more CPU)"));
ui->markButton->setVisible(false);
ui->markButton->setVisible(false);
ui->leSearch->setVisible(false);
ui->searchBefore->setVisible(false);
ui->searchBefore->setToolTip(tr("<b>Find Previous </b><br/><i>Ctrl+Shift+G</i>"));
@ -180,22 +179,26 @@ ChatWidget::ChatWidget(QWidget *parent) :
ui->hashBox->setDropWidget(this);
ui->hashBox->setAutoHide(true);
QMenu *menu = new QMenu();
menu->addAction(ui->actionChooseFont);
menu->addAction(ui->actionChooseColor);
menu->addAction(ui->actionResetFont);
menu->addAction(ui->actionNoEmbed);
menu->addAction(ui->actionSendAsPlainText);
ui->fontButton->setMenu(menu);
QMenu *fontmenu = new QMenu(tr("Set text font & color"));
fontmenu->addAction(ui->actionChooseFont);
fontmenu->addAction(ui->actionChooseColor);
fontmenu->addAction(ui->actionResetFont);
fontmenu->addAction(ui->actionNoEmbed);
fontmenu->addAction(ui->actionSendAsPlainText);
menu = new QMenu();
QMenu *menu = new QMenu();
menu->addAction(ui->actionClearChatHistory);
menu->addAction(ui->actionDeleteChatHistory);
menu->addAction(ui->actionSaveChatHistory);
menu->addAction(ui->actionMessageHistory);
ui->pushtoolsButton->setMenu(menu);
ui->actionSendAsPlainText->setChecked(Settings->getChatSendAsPlainTextByDef());
menu->addMenu(fontmenu);
ui->actionSendAsPlainText->setChecked(Settings->getChatSendAsPlainTextByDef());
ui->textBrowser->setImageBlockWidget(ui->imageBlockWidget);
ui->textBrowser->resetImagesStatus(Settings->getChatLoadEmbeddedImages());//Need to be called after setImageBlockWidget
ui->imageBlockWidget->setAutoHide(true);
ui->textBrowser->installEventFilter(this);
ui->textBrowser->viewport()->installEventFilter(this);
ui->chatTextEdit->installEventFilter(this);

View file

@ -206,6 +206,16 @@ border-image: url(:/images/closepressed.png)
</layout>
</widget>
</item>
<item>
<widget class="RSImageBlockWidget" name="imageBlockWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QSplitter" name="chatVSplitter">
<property name="orientation">
@ -346,69 +356,22 @@ border-image: url(:/images/closepressed.png)
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="../emojione.qrc">
<normaloff>:/emojione/1F603.png</normaloff>:/emojione/1F603.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="fontButton">
<property name="minimumSize">
<size>
<width>32</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>28</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::TabFocus</enum>
</property>
<property name="toolTip">
<string>Set text font &amp; color</string>
<string>Insert emoticon</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/textedit/format-text-color.png</normaloff>:/images/textedit/format-text-color.png</iconset>
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/smiley.png</normaloff>:/icons/png/smiley.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="popupMode">
<enum>QToolButton::InstantPopup</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
@ -416,18 +379,6 @@ border-image: url(:/images/closepressed.png)
</item>
<item>
<widget class="QToolButton" name="attachPictureButton">
<property name="minimumSize">
<size>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
@ -435,13 +386,13 @@ border-image: url(:/images/closepressed.png)
<string>Attach a Picture</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/add_image24.png</normaloff>:/images/add_image24.png</iconset>
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/attach-image.png</normaloff>:/icons/png/attach-image.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="autoRaise">
@ -451,12 +402,6 @@ border-image: url(:/images/closepressed.png)
</item>
<item>
<widget class="QToolButton" name="addFileButton">
<property name="minimumSize">
<size>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
@ -464,13 +409,13 @@ border-image: url(:/images/closepressed.png)
<string>Attach a File</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/attach.png</normaloff>:/images/attach.png</iconset>
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/attach.png</normaloff>:/icons/png/attach.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="autoRaise">
@ -480,29 +425,17 @@ border-image: url(:/images/closepressed.png)
</item>
<item>
<widget class="QToolButton" name="pushtoolsButton">
<property name="minimumSize">
<size>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/configure.png</normaloff>:/images/configure.png</iconset>
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/settings.png</normaloff>:/icons/png/settings.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="popupMode">
@ -513,62 +446,6 @@ border-image: url(:/images/closepressed.png)
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="pluginButtonFrame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QHBoxLayout" name="pluginButtonFrameHLayout">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
</layout>
</widget>
</item>
<item>
<widget class="QToolButton" name="notifyButton">
<property name="minimumSize">
<size>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/chat_red24.png</normaloff>:/images/chat_red24.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="markButton">
<property name="sizePolicy">
@ -577,29 +454,17 @@ border-image: url(:/images/closepressed.png)
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/highlight.png</normaloff>:/images/highlight.png</iconset>
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/highlight.png</normaloff>:/icons/png/highlight.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="checkable">
@ -673,18 +538,6 @@ border-image: url(:/images/closepressed.png)
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
@ -692,13 +545,13 @@ border-image: url(:/images/closepressed.png)
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/find.png</normaloff>:/images/find.png</iconset>
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/search.png</normaloff>:/icons/png/search.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="checkable">
@ -709,6 +562,50 @@ border-image: url(:/images/closepressed.png)
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="notifyButton">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/chat-bubble-notify.png</normaloff>:/icons/png/chat-bubble-notify.png</iconset>
</property>
<property name="iconSize">
<size>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="pluginButtonFrame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QHBoxLayout" name="pluginButtonFrameHLayout">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
</layout>
</widget>
</item>
<item>
<spacer name="toolBarHSpacer">
<property name="orientation">
@ -723,10 +620,38 @@ border-image: url(:/images/closepressed.png)
</spacer>
</item>
<item>
<widget class="QPushButton" name="sendButton">
<property name="text">
<widget class="QToolButton" name="sendButton">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Send</string>
</property>
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;QToolButton:disabled {&lt;/p&gt;&lt;p&gt; image: url(:/icons/png/send-message-blocked.png) ;&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/send-message.png</normaloff>:/icons/png/send-message.png</iconset>
</property>
<property name="iconSize">
<size>
<width>28</width>
<height>28</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
@ -1092,10 +1017,17 @@ border-image: url(:/images/closepressed.png)
<extends>QTextEdit</extends>
<header location="global">gui/common/MimeTextEdit.h</header>
</customwidget>
<customwidget>
<class>RSImageBlockWidget</class>
<extends>QWidget</extends>
<header>gui/common/RSImageBlockWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../emojione.qrc"/>
<include location="../images.qrc"/>
<include location="../icons.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -39,7 +39,7 @@ CreateLobbyDialog::CreateLobbyDialog(const std::set<RsPeerId>& peer_list, int pr
ui = new Ui::CreateLobbyDialog() ;
ui->setupUi(this);
ui->headerFrame->setHeaderImage(QPixmap(":/images/chat_64.png"));
ui->headerFrame->setHeaderImage(QPixmap(":/icons/png/chat-lobbies.png"));
ui->headerFrame->setHeaderText(tr("Create Chat Lobby"));
RsGxsId default_identity ;

View file

@ -116,9 +116,7 @@ FriendList::FriendList(QWidget *parent) :
mShowGroups(true),
mShowState(false),
mHideUnconnected(false),
groupsHasChanged(false),
openGroups(NULL),
openPeers(NULL)
groupsHasChanged(false)
{
ui->setupUi(this);
@ -142,7 +140,7 @@ FriendList::FriendList(QWidget *parent) :
mActionSortByState = new QAction(tr("Sort by state"), this);
mActionSortByState->setCheckable(true);
connect(mActionSortByState, SIGNAL(toggled(bool)), this, SLOT(sortByState(bool)));
ui->peerTreeWidget->addHeaderContextMenuAction(mActionSortByState);
ui->peerTreeWidget->addContextMenuAction(mActionSortByState);
/* Set sort */
sortByColumn(COLUMN_NAME, Qt::AscendingOrder);
@ -189,8 +187,9 @@ void FriendList::addToolButton(QToolButton *toolButton)
/* Initialize button */
toolButton->setAutoRaise(true);
toolButton->setIconSize(ui->displayButton->iconSize());
toolButton->setFocusPolicy(ui->displayButton->focusPolicy());
float S = QFontMetricsF(ui->filterLineEdit->font()).height() ;
toolButton->setIconSize(QSize(S*1.5,S*1.5));
toolButton->setFocusPolicy(Qt::NoFocus);
ui->titleBarFrame->layout()->addWidget(toolButton);
}
@ -219,7 +218,17 @@ void FriendList::processSettings(bool load)
int arrayIndex = Settings->beginReadArray("Groups");
for (int index = 0; index < arrayIndex; ++index) {
Settings->setArrayIndex(index);
addGroupToExpand(Settings->value("open").toString().toStdString());
std::string gids = Settings->value("open").toString().toStdString();
RsGroupInfo ginfo ;
if(rsPeers->getGroupInfoByName(gids,ginfo)) // backward compatibility
addGroupToExpand(ginfo.id) ;
else if(rsPeers->getGroupInfo(RsNodeGroupId(gids),ginfo)) // backward compatibility
addGroupToExpand(ginfo.id) ;
else
std::cerr << "(EE) Cannot find group info for openned group \"" << gids << "\"" << std::endl;
}
Settings->endArray();
} else {
@ -236,11 +245,11 @@ void FriendList::processSettings(bool load)
// open groups
Settings->beginWriteArray("Groups");
int arrayIndex = 0;
std::set<std::string> expandedPeers;
std::set<RsNodeGroupId> expandedPeers;
getExpandedGroups(expandedPeers);
foreach (std::string groupId, expandedPeers) {
foreach (RsNodeGroupId groupId, expandedPeers) {
Settings->setArrayIndex(arrayIndex++);
Settings->setValue("open", QString::fromStdString(groupId));
Settings->setValue("open", QString::fromStdString(groupId.toStdString()));
}
Settings->endArray();
}
@ -273,9 +282,9 @@ void FriendList::peerTreeWidgetCustomPopupMenu()
{
QTreeWidgetItem *c = getCurrentPeer();
QMenu contextMnu(this);
QMenu *contextMenu = new QMenu(this);
QWidget *widget = new QWidget(&contextMnu);
QWidget *widget = new QWidget(contextMenu);
widget->setStyleSheet( ".QWidget{background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #FEFEFE, stop:1 #E8E8E8); border: 1px solid #CCCCCC;}");
// create menu header
@ -284,8 +293,9 @@ void FriendList::peerTreeWidgetCustomPopupMenu()
hbox->setSpacing(6);
QLabel *iconLabel = new QLabel(widget);
iconLabel->setPixmap(QPixmap(":/images/user/friends24.png"));
iconLabel->setMaximumSize(iconLabel->frameSize().height() + 24, 24);
QPixmap pix = QPixmap(":/images/user/friends24.png").scaledToHeight(QFontMetricsF(iconLabel->font()).height()*1.5);
iconLabel->setPixmap(pix);
iconLabel->setMaximumSize(iconLabel->frameSize().height() + pix.height(), pix.width());
hbox->addWidget(iconLabel);
QLabel *textLabel = new QLabel("<strong>RetroShare</strong>", widget);
@ -298,7 +308,7 @@ void FriendList::peerTreeWidgetCustomPopupMenu()
QWidgetAction *widgetAction = new QWidgetAction(this);
widgetAction->setDefaultWidget(widget);
contextMnu.addAction(widgetAction);
contextMenu->addAction(widgetAction);
// create menu entries
if (c)
@ -328,23 +338,23 @@ void FriendList::peerTreeWidgetCustomPopupMenu()
{
bool standard = c->data(COLUMN_DATA, ROLE_STANDARD).toBool();
contextMnu.addAction(QIcon(IMAGE_MSG), tr("Send message to whole group"), this, SLOT(msgfriend()));
contextMnu.addSeparator();
contextMnu.addAction(QIcon(IMAGE_EDIT), tr("Edit Group"), this, SLOT(editGroup()));
contextMenu->addAction(QIcon(IMAGE_MSG), tr("Send message to whole group"), this, SLOT(msgfriend()));
contextMenu->addSeparator();
contextMenu->addAction(QIcon(IMAGE_EDIT), tr("Edit Group"), this, SLOT(editGroup()));
QAction *action = contextMnu.addAction(QIcon(IMAGE_REMOVE), tr("Remove Group"), this, SLOT(removeGroup()));
QAction *action = contextMenu->addAction(QIcon(IMAGE_REMOVE), tr("Remove Group"), this, SLOT(removeGroup()));
action->setDisabled(standard);
}
break;
case TYPE_GPG:
{
contextMnu.addAction(QIcon(IMAGE_CHAT), tr("Chat"), this, SLOT(chatfriendproxy()));
contextMnu.addAction(QIcon(IMAGE_MSG), tr("Send message"), this, SLOT(msgfriend()));
contextMenu->addAction(QIcon(IMAGE_CHAT), tr("Chat"), this, SLOT(chatfriendproxy()));
contextMenu->addAction(QIcon(IMAGE_MSG), tr("Send message"), this, SLOT(msgfriend()));
contextMnu.addSeparator();
contextMenu->addSeparator();
contextMnu.addAction(QIcon(IMAGE_FRIENDINFO), tr("Details"), this, SLOT(configurefriend()));
contextMnu.addAction(QIcon(IMAGE_DENYFRIEND), tr("Deny"), this, SLOT(removefriend()));
contextMenu->addAction(QIcon(IMAGE_FRIENDINFO), tr("Details"), this, SLOT(configurefriend()));
contextMenu->addAction(QIcon(IMAGE_DENYFRIEND), tr("Deny"), this, SLOT(removefriend()));
if(mShowGroups)
{
@ -366,19 +376,19 @@ void FriendList::peerTreeWidgetCustomPopupMenu()
if (std::find(groupIt->peerIds.begin(), groupIt->peerIds.end(), gpgId) == groupIt->peerIds.end()) {
if (parent) {
if (addToGroupMenu == NULL) {
addToGroupMenu = new QMenu(tr("Add to group"), &contextMnu);
addToGroupMenu = new QMenu(tr("Add to group"), contextMenu);
}
QAction* addToGroupAction = new QAction(GroupDefs::name(*groupIt), addToGroupMenu);
addToGroupAction->setData(QString::fromStdString(groupIt->id));
addToGroupAction->setData(QString::fromStdString(groupIt->id.toStdString()));
connect(addToGroupAction, SIGNAL(triggered()), this, SLOT(addToGroup()));
addToGroupMenu->addAction(addToGroupAction);
}
if (moveToGroupMenu == NULL) {
moveToGroupMenu = new QMenu(tr("Move to group"), &contextMnu);
moveToGroupMenu = new QMenu(tr("Move to group"), contextMenu);
}
QAction* moveToGroupAction = new QAction(GroupDefs::name(*groupIt), moveToGroupMenu);
moveToGroupAction->setData(QString::fromStdString(groupIt->id));
moveToGroupAction->setData(QString::fromStdString(groupIt->id.toStdString()));
connect(moveToGroupAction, SIGNAL(triggered()), this, SLOT(moveToGroup()));
moveToGroupMenu->addAction(moveToGroupAction);
} else {
@ -386,7 +396,7 @@ void FriendList::peerTreeWidgetCustomPopupMenu()
}
}
QMenu *groupsMenu = contextMnu.addMenu(QIcon(IMAGE_GROUP16), tr("Groups"));
QMenu *groupsMenu = contextMenu->addMenu(QIcon(IMAGE_GROUP16), tr("Groups"));
groupsMenu->addAction(QIcon(IMAGE_EXPAND), tr("Create new group"), this, SLOT(createNewGroup()));
if (addToGroupMenu || moveToGroupMenu || foundGroup) {
@ -418,45 +428,48 @@ void FriendList::peerTreeWidgetCustomPopupMenu()
case TYPE_SSL:
{
contextMnu.addAction(QIcon(IMAGE_CHAT), tr("Chat"), this, SLOT(chatfriendproxy()));
contextMnu.addAction(QIcon(IMAGE_MSG), tr("Send message"), this, SLOT(msgfriend()));
contextMenu->addAction(QIcon(IMAGE_CHAT), tr("Chat"), this, SLOT(chatfriendproxy()));
contextMenu->addAction(QIcon(IMAGE_MSG), tr("Send message"), this, SLOT(msgfriend()));
contextMnu.addSeparator();
contextMenu->addSeparator();
contextMnu.addAction(QIcon(IMAGE_FRIENDINFO), tr("Details"), this, SLOT(configurefriend()));
contextMenu->addAction(QIcon(IMAGE_FRIENDINFO), tr("Details"), this, SLOT(configurefriend()));
if (type == TYPE_GPG || type == TYPE_SSL) {
contextMnu.addAction(QIcon(IMAGE_EXPORTFRIEND), tr("Recommend this Friend to..."), this, SLOT(recommendfriend()));
contextMenu->addAction(QIcon(IMAGE_EXPORTFRIEND), tr("Recommend this Friend to..."), this, SLOT(recommendfriend()));
}
contextMnu.addAction(QIcon(IMAGE_CONNECT), tr("Attempt to connect"), this, SLOT(connectfriend()));
contextMenu->addAction(QIcon(IMAGE_CONNECT), tr("Attempt to connect"), this, SLOT(connectfriend()));
contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy certificate link"), this, SLOT(copyFullCertificate()));
contextMenu->addAction(QIcon(IMAGE_COPYLINK), tr("Copy certificate link"), this, SLOT(copyFullCertificate()));
//this is a SSL key
contextMnu.addAction(QIcon(IMAGE_REMOVEFRIEND), tr("Remove Friend Node"), this, SLOT(removefriend()));
//this is a SSL key
contextMenu->addAction(QIcon(IMAGE_REMOVEFRIEND), tr("Remove Friend Node"), this, SLOT(removefriend()));
}
}
}
contextMnu.addSeparator();
contextMenu->addSeparator();
QAction *action = contextMnu.addAction(QIcon(IMAGE_PASTELINK), tr("Paste certificate link"), this, SLOT(pastePerson()));
if (RSLinkClipboard::empty(RetroShareLink::TYPE_CERTIFICATE))
action->setDisabled(true);
QAction *action = contextMenu->addAction(QIcon(IMAGE_PASTELINK), tr("Paste certificate link"), this, SLOT(pastePerson()));
if (RSLinkClipboard::empty(RetroShareLink::TYPE_CERTIFICATE))
action->setDisabled(true);
contextMnu.addAction(QIcon(IMAGE_EXPAND), tr("Expand all"), ui->peerTreeWidget, SLOT(expandAll()));
contextMnu.addAction(QIcon(IMAGE_COLLAPSE), tr("Collapse all"), ui->peerTreeWidget, SLOT(collapseAll()));
contextMenu->addAction(QIcon(IMAGE_EXPAND), tr("Expand all"), ui->peerTreeWidget, SLOT(expandAll()));
contextMenu->addAction(QIcon(IMAGE_COLLAPSE), tr("Collapse all"), ui->peerTreeWidget, SLOT(collapseAll()));
contextMnu.exec(QCursor::pos());
contextMenu = ui->peerTreeWidget->createStandardContextMenu(contextMenu);
contextMenu->exec(QCursor::pos());
delete contextMenu;
}
void FriendList::createNewGroup()
{
CreateGroup createGrpDialog ("", this);
CreateGroup createGrpDialog (RsNodeGroupId(), this);
createGrpDialog.exec();
}
@ -596,7 +609,7 @@ void FriendList::insertPeers()
if (mShowGroups && groupsHasChanged) {
if (parent) {
if (parent->type() == TYPE_GROUP) {
std::string groupId = getRsId(parent);
RsNodeGroupId groupId(getRsId(parent));
// the parent is a group, check if the gpg id is assigned to the group
for (groupIt = groupInfoList.begin(); groupIt != groupInfoList.end(); ++groupIt) {
@ -630,7 +643,7 @@ void FriendList::insertPeers()
}
} else if (groupsHasChanged) {
// remove deleted groups
std::string groupId = getRsId(item);
RsNodeGroupId groupId ( getRsId(item));
for (groupIt = groupInfoList.begin(); groupIt != groupInfoList.end(); ++groupIt) {
if (groupIt->id == groupId) {
break;
@ -671,7 +684,7 @@ void FriendList::insertPeers()
int itemCount = peerTreeWidget->topLevelItemCount();
for (int index = 0; index < itemCount; ++index) {
QTreeWidgetItem *groupItemLoop = peerTreeWidget->topLevelItem(index);
if (groupItemLoop->type() == TYPE_GROUP && getRsId(groupItemLoop) == groupInfo->id) {
if (groupItemLoop->type() == TYPE_GROUP && RsNodeGroupId(getRsId(groupItemLoop)) == groupInfo->id) {
groupItem = groupItemLoop;
break;
}
@ -690,7 +703,7 @@ void FriendList::insertPeers()
groupItem->setForeground(COLUMN_NAME, QBrush(textColorGroup()));
/* used to find back the item */
groupItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(groupInfo->id));
groupItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(groupInfo->id.toStdString()));
groupItem->setData(COLUMN_DATA, ROLE_STANDARD, (groupInfo->flag & RS_GROUP_FLAG_STANDARD) ? true : false);
/* Sort data */
@ -716,7 +729,7 @@ void FriendList::insertPeers()
}
}
if (openGroups != NULL && openGroups->find(groupInfo->id) != openGroups->end()) {
if (openGroups.find(groupInfo->id) != openGroups.end()) {
groupItem->setExpanded(true);
}
@ -1168,9 +1181,9 @@ void FriendList::insertPeers()
gpgItem->setData(COLUMN_NAME, ROLE_FILTER, gpgName);
gpgItem->setData(COLUMN_LAST_CONTACT, Qt::DisplayRole, showInfoAtGpgItem ? QVariant(bestLastContact) : "");
gpgItem->setData(COLUMN_LAST_CONTACT, ROLE_SORT_NAME, showInfoAtGpgItem ? QVariant(bestLastContact) : "");
gpgItem->setData(COLUMN_LAST_CONTACT, ROLE_SORT_NAME, QVariant(bestLastContact));
gpgItem->setText(COLUMN_IP, showInfoAtGpgItem ? bestIP : "");
gpgItem->setData(COLUMN_IP, ROLE_SORT_NAME, showInfoAtGpgItem ? bestIP : "");
gpgItem->setData(COLUMN_IP, ROLE_SORT_NAME, bestIP);
/* Sort data */
gpgItem->setData(COLUMN_NAME, ROLE_SORT_NAME, gpgName);
@ -1182,7 +1195,7 @@ void FriendList::insertPeers()
gpgItem->setFont(i, gpgFont);
}
if (openPeers != NULL && openPeers->find(gpgId.toStdString()) != openPeers->end()) {
if (openPeers.find(gpgId.toStdString()) != openPeers.end()) {
gpgItem->setExpanded(true);
}
}
@ -1217,14 +1230,6 @@ void FriendList::insertPeers()
}
groupsHasChanged = false;
if (openGroups != NULL) {
delete(openGroups);
openGroups = NULL;
}
if (openPeers != NULL) {
delete(openPeers);
openPeers = NULL;
}
ui->peerTreeWidget->resort();
}
@ -1232,13 +1237,13 @@ void FriendList::insertPeers()
/**
* Returns a list with all groupIds that are expanded
*/
bool FriendList::getExpandedGroups(std::set<std::string> &groups) const
bool FriendList::getExpandedGroups(std::set<RsNodeGroupId> &groups) const
{
int itemCount = ui->peerTreeWidget->topLevelItemCount();
for (int index = 0; index < itemCount; ++index) {
QTreeWidgetItem *item = ui->peerTreeWidget->topLevelItem(index);
if (item->type() == TYPE_GROUP && item->isExpanded()) {
groups.insert(item->data(COLUMN_DATA, ROLE_ID).toString().toStdString());
groups.insert(RsNodeGroupId(item->data(COLUMN_DATA, ROLE_ID).toString().toStdString()));
}
}
return true;
@ -1626,7 +1631,7 @@ void FriendList::getSslIdsFromItem(QTreeWidgetItem *item, std::list<RsPeerId> &s
case TYPE_GROUP:
{
RsGroupInfo groupInfo;
if (rsPeers->getGroupInfo(peerId, groupInfo)) {
if (rsPeers->getGroupInfo(RsNodeGroupId(peerId), groupInfo)) {
std::set<RsPgpId>::iterator gpgIt;
for (gpgIt = groupInfo.peerIds.begin(); gpgIt != groupInfo.peerIds.end(); ++gpgIt) {
rsPeers->getAssociatedSSLIds(*gpgIt, sslIds);
@ -1649,10 +1654,10 @@ void FriendList::addToGroup()
return;
}
std::string groupId = qobject_cast<QAction*>(sender())->data().toString().toStdString();
RsNodeGroupId groupId ( qobject_cast<QAction*>(sender())->data().toString().toStdString());
RsPgpId gpgId ( getRsId(c));
if (gpgId.isNull() || groupId.empty()) {
if (gpgId.isNull() || groupId.isNull()) {
return;
}
@ -1675,15 +1680,15 @@ void FriendList::moveToGroup()
return;
}
std::string groupId = qobject_cast<QAction*>(sender())->data().toString().toStdString();
RsNodeGroupId groupId ( qobject_cast<QAction*>(sender())->data().toString().toStdString());
RsPgpId gpgId ( getRsId(c));
if (gpgId.isNull() || groupId.empty()) {
if (gpgId.isNull() || groupId.isNull()) {
return;
}
// remove from all groups
rsPeers->assignPeerToGroup("", gpgId, false);
rsPeers->assignPeerToGroup(RsNodeGroupId(), gpgId, false);
// automatically expand the group, the peer is added to
addGroupToExpand(groupId);
@ -1704,7 +1709,7 @@ void FriendList::removeFromGroup()
return;
}
std::string groupId = qobject_cast<QAction*>(sender())->data().toString().toStdString();
RsNodeGroupId groupId ( qobject_cast<QAction*>(sender())->data().toString().toStdString());
RsPgpId gpgId ( getRsId(c));
if (gpgId.isNull()) {
@ -1727,14 +1732,13 @@ void FriendList::editGroup()
return;
}
std::string groupId = getRsId(c);
RsNodeGroupId groupId ( getRsId(c));
if (groupId.empty()) {
return;
if (!groupId.isNull())
{
CreateGroup editGrpDialog(groupId, this);
editGrpDialog.exec();
}
CreateGroup editGrpDialog(groupId, this);
editGrpDialog.exec();
}
void FriendList::removeGroup()
@ -1749,13 +1753,10 @@ void FriendList::removeGroup()
return;
}
std::string groupId = getRsId(c);
RsNodeGroupId groupId ( getRsId(c));
if (groupId.empty()) {
return;
}
rsPeers->removeGroup(groupId);
if (!groupId.isNull())
rsPeers->removeGroup(groupId);
}
void FriendList::exportFriendlistClicked()
@ -2089,7 +2090,7 @@ bool FriendList::importFriendlist(QString &fileName, bool &errorPeers, bool &err
// get name and flags and try to get the group ID
std::string groupName = group.attribute("name").toStdString();
uint32_t flag = group.attribute("flag").toInt();
std::string groupId;
RsNodeGroupId groupId;
if(getOrCreateGroup(groupName, flag, groupId)) {
// group id found!
QDomElement pgpID = group.firstChildElement("pgpID");
@ -2123,7 +2124,7 @@ bool FriendList::importFriendlist(QString &fileName, bool &errorPeers, bool &err
* @param id groupd id for the given name
* @return success or fail
*/
bool FriendList::getGroupIdByName(const std::string &name, std::string &id)
bool FriendList::getGroupIdByName(const std::string &name, RsNodeGroupId &id)
{
std::list<RsGroupInfo> grpList;
if(!rsPeers->getGroupInfoList(grpList))
@ -2146,14 +2147,14 @@ bool FriendList::getGroupIdByName(const std::string &name, std::string &id)
* @param id groupd id
* @return success or failure
*/
bool FriendList::getOrCreateGroup(const std::string &name, const uint &flag, std::string &id)
bool FriendList::getOrCreateGroup(const std::string &name, const uint &flag, RsNodeGroupId &id)
{
if(getGroupIdByName(name, id))
return true;
// -> create one
RsGroupInfo grp;
grp.id = "0"; // RS will generate an ID
grp.id.clear(); // RS will generate an ID
grp.name = name;
grp.flag = flag;
@ -2271,12 +2272,9 @@ void FriendList::filterItems(const QString &text)
* Add a groupId to the openGroups list. These groups
* will be expanded, when they're added to the QTreeWidget
*/
void FriendList::addGroupToExpand(const std::string &groupId)
void FriendList::addGroupToExpand(const RsNodeGroupId &groupId)
{
if (openGroups == NULL) {
openGroups = new std::set<std::string>;
}
openGroups->insert(groupId);
openGroups.insert(groupId);
}
/**
@ -2285,24 +2283,21 @@ void FriendList::addGroupToExpand(const std::string &groupId)
*/
void FriendList::addPeerToExpand(const std::string &gpgId)
{
if (openPeers == NULL) {
openPeers = new std::set<std::string>;
}
openPeers->insert(gpgId);
openPeers.insert(gpgId);
}
void FriendList::createDisplayMenu()
{
QMenu *displayMenu = new QMenu(this);
QMenu *displayMenu = new QMenu(tr("Show Items"), this);
connect(displayMenu, SIGNAL(aboutToShow()), this, SLOT(updateMenu()));
displayMenu->addAction(ui->actionHideOfflineFriends);
displayMenu->addAction(ui->actionShowState);
displayMenu->addAction(ui->actionShowGroups);
displayMenu->addAction(ui->actionExportFriendlist);
displayMenu->addAction(ui->actionImportFriendlist);
ui->displayButton->setMenu(displayMenu);
ui->peerTreeWidget->addContextMenuMenu(displayMenu);
ui->peerTreeWidget->addContextMenuAction(ui->actionExportFriendlist);
ui->peerTreeWidget->addContextMenuAction(ui->actionImportFriendlist);
}
void FriendList::updateMenu()

View file

@ -63,8 +63,8 @@ public:
// Add a tool button to the tool area
void addToolButton(QToolButton *toolButton);
void processSettings(bool load);
void addGroupToExpand(const std::string &groupId);
bool getExpandedGroups(std::set<std::string> &groups) const;
void addGroupToExpand(const RsNodeGroupId &groupId);
bool getExpandedGroups(std::set<RsNodeGroupId> &groups) const;
void addPeerToExpand(const std::string &gpgId);
bool getExpandedPeers(std::set<std::string> &peers) const;
@ -119,8 +119,9 @@ private:
QString mFilterText;
bool groupsHasChanged;
std::set<std::string> *openGroups;
std::set<std::string> *openPeers;
std::set<RsNodeGroupId> openGroups;
#warning this would needs an ID, not a std::string.
std::set<std::string> openPeers;
/* Color definitions (for standard see qss.default) */
QColor mTextColorGroup;
@ -129,8 +130,8 @@ private:
QTreeWidgetItem *getCurrentPeer() const;
void getSslIdsFromItem(QTreeWidgetItem *item, std::list<RsPeerId> &sslIds);
bool getOrCreateGroup(const std::string &name, const uint &flag, std::string &id);
bool getGroupIdByName(const std::string &name, std::string &id);
bool getOrCreateGroup(const std::string &name, const uint &flag, RsNodeGroupId &id);
bool getGroupIdByName(const std::string &name, RsNodeGroupId &id);
bool importExportFriendlistFileDialog(QString &fileName, bool import);
bool exportFriendlist(QString &fileName);

View file

@ -53,38 +53,6 @@
<item>
<widget class="LineEditClear" name="filterLineEdit"/>
</item>
<item>
<widget class="QToolButton" name="displayButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>30</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Display</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/looknfeel.png</normaloff>:/images/looknfeel.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="popupMode">
<enum>QToolButton::InstantPopup</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -188,8 +156,6 @@
<header>gui/common/RSTreeWidget.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
</resources>
<resources/>
<connections/>
</ui>

View file

@ -108,7 +108,7 @@ FriendSelectionWidget::FriendSelectionWidget(QWidget *parent)
mActionSortByState = new QAction(tr("Sort by state"), this);
mActionSortByState->setCheckable(true);
connect(mActionSortByState, SIGNAL(toggled(bool)), this, SLOT(sortByState(bool)));
ui->friendList->addHeaderContextMenuAction(mActionSortByState);
ui->friendList->addContextMenuAction(mActionSortByState);
/* initialize list */
ui->friendList->setColumnCount(COLUMN_COUNT);
@ -271,9 +271,9 @@ void FriendSelectionWidget::secured_fillList()
selectedIds<RsPeerId,IDTYPE_SSL>(sslIdsSelected,true);
}
std::set<std::string> groupIdsSelected;
std::set<RsNodeGroupId> groupIdsSelected;
if (mShowTypes & SHOW_GROUP) {
selectedIds<std::string,IDTYPE_GROUP>(groupIdsSelected,true);
selectedIds<RsNodeGroupId,IDTYPE_GROUP>(groupIdsSelected,true);
}
std::set<RsPgpId> gpgIdsSelected;
@ -305,6 +305,9 @@ void FriendSelectionWidget::secured_fillList()
else
rsPeers->getGPGAcceptedList(gpgIds);
// add own pgp id to the list
gpgIds.push_back(rsPeers->getGPGOwnId()) ;
std::list<RsPeerId> sslIds;
std::list<RsPeerId>::iterator sslIt;
@ -347,7 +350,7 @@ void FriendSelectionWidget::secured_fillList()
groupItem->setTextAlignment(COLUMN_NAME, Qt::AlignLeft | Qt::AlignVCenter);
groupItem->setIcon(COLUMN_NAME, QIcon(IMAGE_GROUP16));
groupItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(groupInfo->id));
groupItem->setData(COLUMN_DATA, ROLE_ID, QString::fromStdString(groupInfo->id.toStdString()));
groupItem->setExpanded(true);
@ -363,7 +366,7 @@ void FriendSelectionWidget::secured_fillList()
groupItem->setCheckState(0, Qt::Unchecked);
}
emit itemAdded(IDTYPE_GROUP, QString::fromStdString(groupInfo->id), groupItem);
emit itemAdded(IDTYPE_GROUP, QString::fromStdString(groupInfo->id.toStdString()), groupItem);
if (std::find(groupIdsSelected.begin(), groupIdsSelected.end(), groupInfo->id) != groupIdsSelected.end()) {
setSelected(mListModus, groupItem, true);
@ -805,16 +808,16 @@ void FriendSelectionWidget::addContextMenuAction(QAction *action)
void FriendSelectionWidget::contextMenuRequested(const QPoint &/*pos*/)
{
QMenu contextMenu(this);
QMenu *contextMenu = new QMenu(this);
if (mListModus == MODUS_CHECK) {
contextMenu.addAction(QIcon(), tr("Mark all"), this, SLOT(selectAll()));
contextMenu.addAction(QIcon(), tr("Mark none"), this, SLOT(deselectAll()));
contextMenu->addAction(QIcon(), tr("Mark all"), this, SLOT(selectAll()));
contextMenu->addAction(QIcon(), tr("Mark none"), this, SLOT(deselectAll()));
}
if (!mContextMenuActions.isEmpty()) {
bool addSeparator = false;
if (!contextMenu.isEmpty()) {
if (!contextMenu->isEmpty()) {
// Check for visible action
foreach (QAction *action, mContextMenuActions) {
if (action->isVisible()) {
@ -825,17 +828,19 @@ void FriendSelectionWidget::contextMenuRequested(const QPoint &/*pos*/)
}
if (addSeparator) {
contextMenu.addSeparator();
contextMenu->addSeparator();
}
contextMenu.addActions(mContextMenuActions);
contextMenu->addActions(mContextMenuActions);
}
if (contextMenu.isEmpty()) {
return;
contextMenu = ui->friendList->createStandardContextMenu(contextMenu);
if (!contextMenu->isEmpty()) {
contextMenu->exec(QCursor::pos());
}
contextMenu.exec(QCursor::pos());
delete contextMenu;
}
void FriendSelectionWidget::itemDoubleClicked(QTreeWidgetItem *item, int /*column*/)

View file

@ -0,0 +1,117 @@
/*
* Retroshare Gxs Support
*
* Copyright 2012-2013 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#include "GroupChooser.h"
#include <algorithm>
#include <iostream>
#include <retroshare/rspeers.h>
/** Constructor */
GroupChooser::GroupChooser(QWidget *parent)
: QComboBox(parent), mFlags(0)
{
return;
}
void GroupChooser::loadGroups(uint32_t chooserFlags, const RsNodeGroupId& defaultId)
{
mFlags = chooserFlags;
mDefaultGroupId = defaultId;
loadGroups();
}
bool GroupChooser::makeNodeGroupDesc(const RsGroupInfo& info, QString &desc)
{
desc.clear();
if(info.name.empty())
desc = tr("[Unknown]") ;
else
desc = "\"" + QString::fromUtf8(info.name.c_str()) + "\"";
desc += " [" ;
desc += QString::fromStdString(info.id.toStdString().substr(0,3));
desc += "...";
desc += QString::fromStdString(info.id.toStdString().substr(info.id.toStdString().length()-2,2));
desc += "]";
return true;
}
void GroupChooser::loadGroups()
{
std::list<RsGroupInfo> ids;
rsPeers->getGroupInfoList(ids);
if (ids.empty())
{
std::cerr << "GroupChooser::loadGroups() ERROR no ids";
std::cerr << std::endl;
return;
}
int i = 0;
int def = -1;
for( std::list<RsGroupInfo>::iterator it = ids.begin(); it != ids.end(); ++it, ++i)
{
/* add to Chooser */
QString str;
if (!makeNodeGroupDesc(*it, str))
{
std::cerr << "GroupChooser::loadGroups() ERROR Desc for Id: " << it->id;
std::cerr << std::endl;
continue;
}
QString id = QString::fromStdString(it->id.toStdString());
addItem(str, id);
if (mDefaultGroupId == it->id)
def = i;
}
if (def >= 0)
{
setCurrentIndex(def);
}
}
bool GroupChooser::getChosenGroup(RsNodeGroupId& id)
{
if (count() < 1)
return false;
int idx = currentIndex();
QVariant var = itemData(idx);
id = RsNodeGroupId(var.toString().toStdString());
return true;
}

View file

@ -0,0 +1,45 @@
/*
* Retroshare Gxs Support
*
* Copyright 2012-2013 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#pragma once
#include <QComboBox>
#include <retroshare/rspeers.h>
class GroupChooser : public QComboBox
{
public:
GroupChooser(QWidget *parent = NULL);
void loadGroups(uint32_t chooserFlags, const RsNodeGroupId& defaultId);
bool getChosenGroup(RsNodeGroupId& id);
static bool makeNodeGroupDesc(const RsGroupInfo& info, QString &desc);
private:
void loadGroups();
uint32_t mFlags;
RsNodeGroupId mDefaultGroupId;
};

View file

@ -51,7 +51,7 @@ const QString GroupDefs::name(const RsGroupInfo &groupInfo)
return qApp->translate("GroupDefs", "Favorites");
}
std::cerr << "GroupDefs::name: Unknown group id requested " << groupInfo.id;
std::cerr << "GroupDefs::name: Unknown group id requested " << groupInfo.id << std::endl;
return "";
}

View file

@ -20,7 +20,7 @@ GroupSelectionBox::GroupSelectionBox(QWidget *parent)
void GroupSelectionBox::fillGroups()
{
std::list<std::string> selectedIds;
std::list<RsNodeGroupId> selectedIds;
selectedGroupIds(selectedIds);
clear();
@ -30,7 +30,7 @@ void GroupSelectionBox::fillGroups()
for (std::list<RsGroupInfo>::const_iterator it(groupIds.begin()); it != groupIds.end(); ++it) {
QListWidgetItem *item = new QListWidgetItem(GroupDefs::name(*it));
item->setData(ROLE_ID, QString::fromStdString(it->id));
item->setData(ROLE_ID, QString::fromStdString(it->id.toStdString()));
item->setBackgroundColor(QColor(183,236,181));
addItem(item);
}
@ -38,27 +38,27 @@ void GroupSelectionBox::fillGroups()
setSelectedGroupIds(selectedIds);
}
void GroupSelectionBox::selectedGroupIds(std::list<std::string> &groupIds) const
void GroupSelectionBox::selectedGroupIds(std::list<RsNodeGroupId> &groupIds) const
{
int itemCount = count();
for (int i = 0; i < itemCount; ++i) {
QListWidgetItem *listItem = item(i);
if (listItem->checkState() == Qt::Checked) {
groupIds.push_back(item(i)->data(ROLE_ID).toString().toStdString());
groupIds.push_back(RsNodeGroupId(item(i)->data(ROLE_ID).toString().toStdString()));
std::cerr << "Adding selected item " << groupIds.back() << std::endl;
}
}
}
void GroupSelectionBox::setSelectedGroupIds(const std::list<std::string>& groupIds)
void GroupSelectionBox::setSelectedGroupIds(const std::list<RsNodeGroupId>& groupIds)
{
int itemCount = count();
for (int i = 0; i < itemCount; ++i) {
QListWidgetItem *listItem = item(i);
if (std::find(groupIds.begin(), groupIds.end(), listItem->data(ROLE_ID).toString().toStdString()) != groupIds.end()) {
if (std::find(groupIds.begin(), groupIds.end(), RsNodeGroupId(listItem->data(ROLE_ID).toString().toStdString())) != groupIds.end()) {
listItem->setCheckState(Qt::Checked);
} else {
listItem->setCheckState(Qt::Unchecked);

View file

@ -1,4 +1,5 @@
#include <QListWidget>
#include <retroshare/rsids.h>
class GroupSelectionBox: public QListWidget
{
@ -7,10 +8,10 @@ class GroupSelectionBox: public QListWidget
public:
GroupSelectionBox(QWidget *parent);
void selectedGroupIds(std::list<std::string> &groupIds) const;
void selectedGroupIds(std::list<RsNodeGroupId> &groupIds) const;
void selectedGroupNames(QList<QString> &groupNames) const;
void setSelectedGroupIds(const std::list<std::string> &groupIds);
void setSelectedGroupIds(const std::list<RsNodeGroupId> &groupIds);
private slots:
void fillGroups();

View file

@ -14,7 +14,16 @@
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@ -32,7 +41,16 @@
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
@ -52,8 +70,8 @@
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>16</height>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="popupMode">

View file

@ -26,15 +26,28 @@
RSImageBlockWidget::RSImageBlockWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::RSImageBlockWidget)
ui(new Ui::RSImageBlockWidget),
mAutoHide(false), mAutoHideHeight(4), mAutoHideTimeToStart(3000), mAutoHideDuration(3000)
{
ui->setupUi(this);
mDefaultRect = this->geometry();
ui->infoFrame->installEventFilter(this);
mTimer = new RsProtectedTimer(this);
mTimer->setSingleShot(true);
connect(mTimer, SIGNAL(timeout()), this, SLOT(startAutoHide()));
mAnimation = new QPropertyAnimation(this, "geometry");
connect(ui->loadImagesButton, SIGNAL(clicked()), this, SIGNAL(showImages()));
}
RSImageBlockWidget::~RSImageBlockWidget()
{
delete mAnimation;
mTimer->stop();
delete mTimer;
delete ui;
}
@ -64,3 +77,61 @@ void RSImageBlockWidget::addButtonAction(const QString &text, const QObject *rec
connect(action, SIGNAL(triggered()), this, SIGNAL(showImages()));
}
}
bool RSImageBlockWidget::eventFilter(QObject *obj, QEvent *event)
{
if (mAutoHide) {
if (event->type() == QEvent::Show) {
mTimer->start(mAutoHideTimeToStart);
}
if (event->type() == QEvent::Hide) {
mTimer->stop();
}
if (event->type() == QEvent::Enter) {
mAnimation->stop();
this->setGeometry(mDefaultRect);
this->updateGeometry();
mTimer->start(mAutoHideTimeToStart);
mAnimation->setCurrentTime(0);
}
}
if (mAnimation->currentTime() == 0) {
mDefaultRect = this->geometry();
} else if (mAnimation->state() == QAbstractAnimation::Running) {
this->updateGeometry();
}
// pass the event on to the parent class
return QObject::eventFilter(obj, event);
}
void RSImageBlockWidget::setAutoHide(const bool value)
{
if(value && !mAutoHide) {
if (this->isVisible()) mTimer->start(mAutoHideTimeToStart);
} else if (!value && mAutoHide) {
mTimer->stop();
}
mAutoHide = value;
}
void RSImageBlockWidget::startAutoHide()
{
QRect r = mDefaultRect;
r.setHeight(mAutoHideHeight);
this->setSizePolicy(QSizePolicy::Ignored,QSizePolicy::Preferred);
mAnimation->setDuration(mAutoHideDuration);
mAnimation->setStartValue(mDefaultRect);
mAnimation->setEndValue(r);
mAnimation->start();
}
QSize RSImageBlockWidget::sizeHint() const
{
if (mAnimation->currentTime() == 0) {
return mDefaultRect.size();
} else {
return mAnimation->currentValue().toRect().size();
}
}

View file

@ -22,8 +22,11 @@
#ifndef RSIMAGEBLOCKWIDGET_H
#define RSIMAGEBLOCKWIDGET_H
#include <QPropertyAnimation>
#include <QWidget>
#include "util/RsProtectedTimer.h"
namespace Ui {
class RSImageBlockWidget;
}
@ -32,17 +35,48 @@ class RSImageBlockWidget : public QWidget
{
Q_OBJECT
Q_PROPERTY(bool autoHide READ autoHide WRITE setAutoHide)
Q_PROPERTY(int autoHideHeight READ autoHideHeight WRITE setAutoHideHeight)
Q_PROPERTY(int autoHideTimeToStart READ autoHideTimeToStart WRITE setAutoHideTimeToStart)
Q_PROPERTY(int autoHideDuration READ autoHideDuration WRITE setAutoHideDuration)
public:
explicit RSImageBlockWidget(QWidget *parent = 0);
~RSImageBlockWidget();
void addButtonAction(const QString &text, const QObject *receiver, const char *member, bool standardAction);
virtual QSize sizeHint() const;//To update parent layout.
virtual QSize minimumSizeHint() const { return sizeHint();}//To update parent layout.
bool autoHide() { return mAutoHide; }
int autoHideHeight() { return mAutoHideHeight; }
int autoHideTimeToStart() { return mAutoHideTimeToStart; }
int autoHideDuration() { return mAutoHideDuration; }
void setAutoHide(const bool value);
void setAutoHideHeight(const int value) { mAutoHideHeight = value; }
void setAutoHideTimeToStart(const int value) { mAutoHideTimeToStart = value; }
void setAutoHideDuration(const int value) { mAutoHideDuration = value; }
signals:
void showImages();
private slots:
void startAutoHide();
protected:
bool eventFilter(QObject *obj, QEvent *event);
private:
Ui::RSImageBlockWidget *ui;
QPropertyAnimation *mAnimation;
QRect mDefaultRect;
RsProtectedTimer *mTimer;
bool mAutoHide;
int mAutoHideHeight;
int mAutoHideTimeToStart;
int mAutoHideDuration;
};
#endif // RSIMAGEBLOCKWIDGET_H

View file

@ -13,11 +13,20 @@
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="RSImageBlockWidgetHLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@ -92,8 +101,17 @@
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<layout class="QHBoxLayout" name="infoFrameHLayout">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item>
@ -114,7 +132,7 @@
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<spacer name="infoFrameHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>

View file

@ -1,11 +1,14 @@
#include <iostream>
#include <QDir>
#include <QDesktopServices>
#include <QPainter>
#include "RSTextBrowser.h"
#include "RSImageBlockWidget.h"
#include <retroshare/rsinit.h> //To get RsAccounts
RSTextBrowser::RSTextBrowser(QWidget *parent) :
QTextBrowser(parent)
{
@ -74,25 +77,33 @@ void RSTextBrowser::paintEvent(QPaintEvent *event)
QVariant RSTextBrowser::loadResource(int type, const QUrl &name)
{
// case 1: always trust the image if it comes from an internal resource
if(name.scheme().compare("qrc",Qt::CaseInsensitive)==0 && type == QTextDocument::ImageResource)
return QTextBrowser::loadResource(type, name);
// case 2: only display if the user allows it. Data resources can be bad (svg bombs) but we filter them out globally at the network layer.
// It would be good to add here a home-made resource loader that only loads images and not svg crap, just in case.
if(name.scheme().compare("data",Qt::CaseInsensitive)==0 && mShowImages)
return QTextBrowser::loadResource(type, name);
// case 3: otherwise, do not display
std::cerr << "TEXTBROWSER: refusing load ressource request: type=" << type << " scheme=" << name.scheme().toStdString() << ", url=" << name.toString().toStdString() << std::endl;
if (mImageBlockWidget)
mImageBlockWidget->show();
// case 1: always trust the image if it comes from an internal resource.
return QPixmap(":/trolltech/styles/commonstyle/images/file-16.png");
if(name.scheme().compare("qrc",Qt::CaseInsensitive)==0 && type == QTextDocument::ImageResource)
return QTextBrowser::loadResource(type, name);
// case 2: always trust the image if it comes from local Config or Data directories.
if(name.scheme().compare("file",Qt::CaseInsensitive)==0 && type == QTextDocument::ImageResource) {
if (name.path().startsWith(QDir(QString::fromUtf8(RsAccounts::ConfigDirectory().c_str())).absolutePath().prepend("/"),Qt::CaseInsensitive)
|| name.path().startsWith(QDir(QString::fromUtf8(RsAccounts::DataDirectory().c_str())).absolutePath().prepend("/"),Qt::CaseInsensitive))
return QTextBrowser::loadResource(type, name);
}
// case 3: only display if the user allows it. Data resources can be bad (svg bombs) but we filter them out globally at the network layer.
// It would be good to add here a home-made resource loader that only loads images and not svg crap, just in case.
if(name.scheme().compare("data",Qt::CaseInsensitive)==0 && mShowImages)
return QTextBrowser::loadResource(type, name);
// case 4: otherwise, do not display
std::cerr << "TEXTBROWSER: refusing load ressource request: type=" << type << " scheme=" << name.scheme().toStdString() << ", url=" << name.toString().toStdString() << std::endl;
if (mImageBlockWidget)
mImageBlockWidget->show();
return QPixmap(":/images/imageblocked_24.png");
}
void RSTextBrowser::setImageBlockWidget(RSImageBlockWidget *widget)

View file

@ -18,13 +18,16 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QPainter>
#include <QMouseEvent>
#include <QHeaderView>
#include <QMenu>
#include "RSTreeWidget.h"
#include <QHBoxLayout>
#include <QHeaderView>
#include <QLabel>
#include <QMenu>
#include <QMouseEvent>
#include <QPainter>
#include <QWidgetAction>
#include "gui/settings/rsharesettings.h"
RSTreeWidget::RSTreeWidget(QWidget *parent) : QTreeWidget(parent)
@ -164,16 +167,54 @@ void RSTreeWidget::setColumnCustomizable(int column, bool customizable)
mColumnCustomizable[column] = customizable;
}
void RSTreeWidget::addHeaderContextMenuAction(QAction *action)
void RSTreeWidget::addContextMenuAction(QAction *action)
{
mHeaderContextMenuActions.push_back(action);
mContextMenuActions.push_back(action);
}
void RSTreeWidget::headerContextMenuRequested(const QPoint &pos)
void RSTreeWidget::addContextMenuMenu(QMenu *menu)
{
QMenu contextMenu(this);
mContextMenuMenus.push_back(menu);
}
QMenu *RSTreeWidget::createStandardContextMenu(QMenu *contextMenu)
{
if (!contextMenu){
contextMenu = new QMenu(this);
contextMenu->addSeparator();
}
if(!mContextMenuActions.isEmpty() || mEnableColumnCustomize ||!mContextMenuActions.isEmpty() || !mContextMenuMenus.isEmpty()) {
QWidget *widget = new QWidget(contextMenu);
widget->setStyleSheet( ".QWidget{background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 #FEFEFE, stop:1 #E8E8E8); border: 1px solid #CCCCCC;}");
// create menu header
QHBoxLayout *hbox = new QHBoxLayout(widget);
hbox->setMargin(0);
hbox->setSpacing(6);
QLabel *iconLabel = new QLabel(widget);
QPixmap pix = QPixmap(":/images/settings.png").scaledToHeight(QFontMetricsF(iconLabel->font()).height()*1.5);
iconLabel->setPixmap(pix);
iconLabel->setMaximumSize(iconLabel->frameSize().height() + pix.height(), pix.width());
hbox->addWidget(iconLabel);
QLabel *textLabel = new QLabel("<strong>" + tr("Tree View Options") + "</strong>", widget);
hbox->addWidget(textLabel);
QSpacerItem *spacerItem = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
hbox->addItem(spacerItem);
widget->setLayout(hbox);
QWidgetAction *widgetAction = new QWidgetAction(this);
widgetAction->setDefaultWidget(widget);
contextMenu->addAction(widgetAction);
}
if (mEnableColumnCustomize) {
QMenu *headerMenu = contextMenu->addMenu(QIcon(),tr("Show Headers"));
QTreeWidgetItem *item = headerItem();
int columnCount = item->columnCount();
for (int column = 0; column < columnCount; ++column) {
@ -181,18 +222,18 @@ void RSTreeWidget::headerContextMenuRequested(const QPoint &pos)
if (it != mColumnCustomizable.end() && *it == false) {
continue;
}
QAction *action = contextMenu.addAction(QIcon(), item->text(column), this, SLOT(columnVisible()));
QAction *action = headerMenu->addAction(QIcon(), item->text(column), this, SLOT(columnVisible()));
action->setCheckable(true);
action->setData(column);
action->setChecked(!isColumnHidden(column));
}
}
if (!mHeaderContextMenuActions.isEmpty()) {
if (!mContextMenuActions.isEmpty()) {
bool addSeparator = false;
if (!contextMenu.isEmpty()) {
if (!contextMenu->isEmpty()) {
// Check for visible action
foreach (QAction *action, mHeaderContextMenuActions) {
foreach (QAction *action, mContextMenuActions) {
if (action->isVisible()) {
addSeparator = true;
break;
@ -201,17 +242,31 @@ void RSTreeWidget::headerContextMenuRequested(const QPoint &pos)
}
if (addSeparator) {
contextMenu.addSeparator();
contextMenu->addSeparator();
}
contextMenu.addActions(mHeaderContextMenuActions);
contextMenu->addActions(mContextMenuActions);
}
if (contextMenu.isEmpty()) {
if (!mContextMenuMenus.isEmpty()) {
foreach(QMenu *menu, mContextMenuMenus) {
contextMenu->addSeparator();
contextMenu->addMenu(menu);
}
}
return contextMenu;
}
void RSTreeWidget::headerContextMenuRequested(const QPoint &pos)
{
QMenu *contextMenu = createStandardContextMenu(NULL);
if (contextMenu->isEmpty()) {
return;
}
contextMenu.exec(mapToGlobal(pos));
contextMenu->exec(mapToGlobal(pos));
delete contextMenu;
}
void RSTreeWidget::columnVisible()

View file

@ -46,7 +46,11 @@ public:
void resort();
// Add QAction to context menu (action won't be deleted)
void addHeaderContextMenuAction(QAction *action);
void addContextMenuAction(QAction *action);
// Add QMenu to context menu (menu won't be deleted)
void addContextMenuMenu(QMenu *menu);
// Get Default context menu (Columns choice and menus added)
QMenu *createStandardContextMenu(QMenu *menu);
signals:
void signalMouseMiddleButtonClicked(QTreeWidgetItem *item);
@ -68,7 +72,8 @@ private:
bool mEnableColumnCustomize;
quint32 mSettingsVersion;
QMap<int, bool> mColumnCustomizable;
QList<QAction*> mHeaderContextMenuActions;
QList<QAction*> mContextMenuActions;
QList<QMenu*> mContextMenuMenus;
};
#endif

View file

@ -160,6 +160,7 @@ RsCollectionDialog::RsCollectionDialog(const QString& collectionFileName
connect(ui._addRecur_PB, SIGNAL(clicked()), this, SLOT(addRecursive()));
connect(ui._remove_PB, SIGNAL(clicked()), this, SLOT(remove()));
connect(ui._makeDir_PB, SIGNAL(clicked()), this, SLOT(makeDir()));
connect(ui._removeDuplicate_CB, SIGNAL(clicked(bool)), this, SLOT(updateRemoveDuplicate(bool)));
connect(ui._cancel_PB, SIGNAL(clicked()), this, SLOT(cancel()));
connect(ui._save_PB, SIGNAL(clicked()), this, SLOT(save()));
connect(ui._download_PB, SIGNAL(clicked()), this, SLOT(download()));
@ -190,6 +191,7 @@ RsCollectionDialog::RsCollectionDialog(const QString& collectionFileName
// 5 Activate button follow creationMode
ui._changeFile->setVisible(_creationMode && !_readOnly);
ui._makeDir_PB->setVisible(_creationMode && !_readOnly);
ui._removeDuplicate_CB->setVisible(_creationMode && !_readOnly);
ui._save_PB->setVisible(_creationMode && !_readOnly);
ui._treeViewFrame->setVisible(_creationMode && !_readOnly);
ui._download_PB->setVisible(!_creationMode && !_readOnly);
@ -408,7 +410,10 @@ bool RsCollectionDialog::addChild(QTreeWidgetItem* parent, const std::vector<Col
if (colFileInfo.type == DIR_TYPE_DIR){
founds = ui._fileEntriesTW->findItems(colFileInfo.path + "/" +colFileInfo.name, Qt::MatchExactly | Qt::MatchRecursive, COLUMN_FILEPATH);
} else {
founds = ui._fileEntriesTW->findItems(colFileInfo.hash, Qt::MatchExactly | Qt::MatchRecursive, COLUMN_HASH);
founds = ui._fileEntriesTW->findItems(colFileInfo.path + "/" +colFileInfo.name, Qt::MatchExactly | Qt::MatchRecursive, COLUMN_FILEPATH);
if (ui._removeDuplicate_CB->isChecked()) {
founds << ui._fileEntriesTW->findItems(colFileInfo.hash, Qt::MatchExactly | Qt::MatchRecursive, COLUMN_HASH);
}
}
if (founds.empty()) {
QTreeWidgetItem *item = new QTreeWidgetItem;
@ -493,7 +498,8 @@ bool RsCollectionDialog::addChild(QTreeWidgetItem* parent, const std::vector<Col
if (colFileInfo.type == DIR_TYPE_DIR) {
wrong_chars |= addChild(founds.at(0), colFileInfo.children);
} }
}
}
}
return wrong_chars;
}
@ -799,7 +805,7 @@ bool RsCollectionDialog::addAllChild(QFileInfo &fileInfoParent
*/
void RsCollectionDialog::remove()
{
bool removeOnlyFile=false;
bool removeOnlyFile=false;
QString listDir;
// First, check if selection contains directories
for (int curs = 0; curs < ui._fileEntriesTW->selectedItems().count(); ++curs)
@ -827,9 +833,29 @@ void RsCollectionDialog::remove()
//msgBox->setInformativeText(); If text too long, no scroll, so I add an text edit
QGridLayout* layout = qobject_cast<QGridLayout*>(msgBox->layout());
if (layout) {
QTextEdit* edit = new QTextEdit(tr("Do you want to remove them and all their children, too? <br>") + listDir);
int newRow = 1;
for (int row = layout->count()-1; row >= 0; --row) {
for (int col = layout->columnCount()-1; col >= 0; --col) {
QLayoutItem *item = layout->itemAtPosition(row, col);
if (item) {
int index = layout->indexOf(item->widget());
int r=0, c=0, rSpan=0, cSpan=0;
layout->getItemPosition(index, &r, &c, &rSpan, &cSpan);
if (r>0) {
layout->removeItem(item);
layout->addItem(item, r+3, c, rSpan, cSpan);
} else if (rSpan>1) {
newRow = rSpan + 1;
}
}
}
}
QLabel *label = new QLabel(tr("Do you want to remove them and all their children, too?"));
layout->addWidget(label,newRow, 0, 1, layout->columnCount(), Qt::AlignHCenter );
QTextEdit *edit = new QTextEdit(listDir);
edit->setReadOnly(true);
layout->addWidget(edit,0 ,1);
edit->setWordWrapMode(QTextOption::NoWrap);
layout->addWidget(edit,newRow+1, 0, 1, layout->columnCount(), Qt::AlignHCenter );
}
msgBox->setStandardButtons(QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
@ -854,20 +880,49 @@ void RsCollectionDialog::remove()
}//if (!listDir.isEmpty())
//Remove wanted items
for (int curs = 0; curs < ui._fileEntriesTW->selectedItems().count(); ++curs)
{// Have to call ui._fileEntriesTW->selectedItems().count() each time as selected change
QTreeWidgetItem *item = NULL;
item= ui._fileEntriesTW->selectedItems().at(curs);
int leftItem = 0;
// Have to call ui._fileEntriesTW->selectedItems().count() each time as selected change
while (ui._fileEntriesTW->selectedItems().count() > leftItem) {
QTreeWidgetItem *item = ui._fileEntriesTW->selectedItems().at(leftItem);
if (item != getRootItem()){
if ((item->data(COLUMN_HASH, ROLE_TYPE).toUInt() != DIR_TYPE_DIR) || !removeOnlyFile) {
if (!removeItem(item, removeOnlyFile)) {
++leftItem;
}
} else {
//Get Root change index
++leftItem;
}
}
updateSizes() ;
}
bool RsCollectionDialog::removeItem(QTreeWidgetItem *item, bool &removeOnlyFile)
{
if (item){
if ((item->data(COLUMN_HASH, ROLE_TYPE).toUInt() != DIR_TYPE_DIR) || !removeOnlyFile) {
int leftItem = 0;
while (item->childCount() > leftItem) {
if (!removeItem(item->child(0), removeOnlyFile)) {
++leftItem;
}
}
if (leftItem == 0) {
//First uncheck item to update parent informations
item->setCheckState(COLUMN_FILE,Qt::Unchecked);
QTreeWidgetItem *parent = item->parent();
parent->removeChild(item);
curs = 0;//Cause we don't know how many child of this item was selected (and don't want iterate them ;) )
return true;
} else {
if (!removeOnlyFile) {
std::cerr << "(EE) RsCollectionDialog::removeItem This could never happen." << std::endl;
}
}
}//if (item != getRootItem())*
}//for (int curs = 0; curs < count; ++curs)
}
}
return false;
}
/** Process each item to make a new RsCollection item */
@ -1063,6 +1118,94 @@ void RsCollectionDialog::itemChanged(QTreeWidgetItem *item, int col)
}
/**
* @brief RsCollectionDialog::updateRemoveDuplicate Remove all duplicate file when checked.
* @param checked
*/
void RsCollectionDialog::updateRemoveDuplicate(bool checked)
{
if (checked) {
bool bRemoveAll = false;
QTreeWidgetItemIterator it(ui._fileEntriesTW);
QTreeWidgetItem *item;
while ((item = *it) != NULL) {
++it;
if (item->data(COLUMN_HASH, ROLE_TYPE).toUInt() != DIR_TYPE_DIR) {
QList<QTreeWidgetItem*> founds;
founds << ui._fileEntriesTW->findItems(item->text(COLUMN_HASH), Qt::MatchExactly | Qt::MatchRecursive, COLUMN_HASH);
if (founds.count() > 1) {
bool bRemove = false;
if (!bRemoveAll) {
QMessageBox* msgBox = new QMessageBox(QMessageBox::Information, "", "");
msgBox->setText("Warning, duplicate file found.");
//msgBox->setInformativeText(); If text too long, no scroll, so I add an text edit
msgBox->setStandardButtons(QMessageBox::YesToAll | QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
msgBox->setDefaultButton(QMessageBox::Yes);
QGridLayout* layout = qobject_cast<QGridLayout*>(msgBox->layout());
if (layout) {
int newRow = 1;
for (int row = layout->count()-1; row >= 0; --row) {
for (int col = layout->columnCount()-1; col >= 0; --col) {
QLayoutItem *item = layout->itemAtPosition(row, col);
if (item) {
int index = layout->indexOf(item->widget());
int r=0, c=0, rSpan=0, cSpan=0;
layout->getItemPosition(index, &r, &c, &rSpan, &cSpan);
if (r>0) {
layout->removeItem(item);
layout->addItem(item, r+3, c, rSpan, cSpan);
} else if (rSpan>1) {
newRow = rSpan + 1;
}
}
}
}
QLabel *label = new QLabel(tr("Do you want to remove this file from the list?"));
layout->addWidget(label,newRow, 0, 1, layout->columnCount(), Qt::AlignHCenter );
QTextEdit *edit = new QTextEdit(item->text(COLUMN_FILEPATH));
edit->setReadOnly(true);
edit->setWordWrapMode(QTextOption::NoWrap);
layout->addWidget(edit,newRow+1, 0, 1, layout->columnCount(), Qt::AlignHCenter );
}
int ret = msgBox->exec();
switch (ret) {
case QMessageBox::YesToAll: {
bRemoveAll = true;
}
break;
case QMessageBox::Yes: {
bRemove = true;
}
break;
case QMessageBox::No:
break;
case QMessageBox::Cancel: {
delete msgBox;
ui._removeDuplicate_CB->setChecked(false);
return;
}
break;
default:
// should never be reached
break;
}
delete msgBox;
}
if (bRemove || bRemoveAll) {
//First uncheck item to update parent informations
item->setCheckState(COLUMN_FILE,Qt::Unchecked);
item->parent()->removeChild(item);
}
}
}
}
}
}
/**
* @brief RsCollectionDialog::cancel: Cancel RScollection editing or donwloading
*/

View file

@ -56,6 +56,7 @@ private slots:
void makeDir() ;
void fileHashingFinished(QList<HashedFile> hashedFiles) ;
void itemChanged(QTreeWidgetItem* item,int col) ;
void updateRemoveDuplicate(bool checked);
void cancel() ;
void download() ;
void save() ;
@ -68,6 +69,7 @@ private:
QTreeWidgetItem* getRootItem();
bool updateList();
bool addChild(QTreeWidgetItem *parent, const std::vector<ColFileInfo> &child);
bool removeItem(QTreeWidgetItem *item, bool &removeOnlyFile) ;
void addRecursive(bool recursive) ;
bool addAllChild(QFileInfo &fileInfoParent
, QMap<QString, QString > &dirToAdd

View file

@ -21,7 +21,16 @@
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
@ -59,7 +68,16 @@
<enum>QFrame::Plain</enum>
</property>
<layout class="QVBoxLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@ -83,7 +101,16 @@
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@ -197,7 +224,16 @@
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@ -207,7 +243,16 @@
</property>
<widget class="QFrame" name="_treeViewFrame">
<layout class="QHBoxLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@ -359,6 +404,13 @@
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QCheckBox" name="_removeDuplicate_CB">
<property name="text">
<string>Remove Duplicate</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
@ -405,12 +457,6 @@
</widget>
</item>
</layout>
<zorder></zorder>
<zorder></zorder>
<zorder>_mainSplitter</zorder>
<zorder>_listSplitter</zorder>
<zorder></zorder>
<zorder>_mainSplitter</zorder>
</widget>
</item>
</layout>

View file

@ -31,18 +31,20 @@
#include <QUrlQuery>
#endif
#include "gui/settings/rsharesettings.h"
#include "util/misc.h"
#include "ConnectFriendWizard.h"
#include "ui_ConnectFriendWizard.h"
#include "gui/common/PeerDefs.h"
#include "gui/notifyqt.h"
#include "gui/common/GroupDefs.h"
#include "gui/GetStartedDialog.h"
#include "gui/msgs/MessageComposer.h"
#include <retroshare/rsiface.h>
#include <retroshare/rsbanlist.h>
#include "ConnectProgressDialog.h"
#include "gui/GetStartedDialog.h"
//#define FRIEND_WIZARD_DEBUG
@ -297,7 +299,7 @@ static void fillGroups(ConnectFriendWizard *wizard, QComboBox *comboBox, const Q
GroupDefs::sortByName(groupInfoList);
comboBox->addItem("", ""); // empty value
for (std::list<RsGroupInfo>::iterator groupIt = groupInfoList.begin(); groupIt != groupInfoList.end(); ++groupIt) {
comboBox->addItem(GroupDefs::name(*groupIt), QString::fromStdString(groupIt->id));
comboBox->addItem(GroupDefs::name(*groupIt), QString::fromStdString(groupIt->id.toStdString()));
}
if (groupId.isEmpty() == false) {
@ -853,7 +855,7 @@ void ConnectFriendWizard::accept()
}
if (!groupId.isEmpty())
rsPeers->assignPeerToGroup(groupId.toStdString(), peerDetails.gpg_id, true);
rsPeers->assignPeerToGroup(RsNodeGroupId(groupId.toStdString()), peerDetails.gpg_id, true);
}
if ((accept_connection) && (!peerDetails.id.isNull()))
@ -1040,7 +1042,9 @@ void ConnectFriendWizard::saveCert()
void ConnectFriendWizard::loadFriendCert()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Select Certificate"), "", tr("RetroShare Certificate (*.rsc );;All Files (*)"));
QString fileName ;
if(!misc::getOpenFileName(this, RshareSettings::LASTDIR_CERT, tr("Select Certificate"), tr("RetroShare Certificate (*.rsc );;All Files (*)"),fileName))
return ;
if (!fileName.isNull()) {
ui->friendFileNameEdit->setText(fileName);

View file

@ -52,6 +52,7 @@ GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId,
requestGroup();
requestMessage();
requestComment();
}
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, const RsGxsChannelPost &post, bool isHome, bool autoUpdate) :
@ -66,6 +67,7 @@ GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId,
setGroup(group, false);
setPost(post);
requestComment();
}
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost &post, bool isHome, bool autoUpdate) :
@ -80,6 +82,7 @@ GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId,
requestGroup();
setPost(post);
requestComment();
}
GxsChannelPostItem::~GxsChannelPostItem()
@ -269,10 +272,36 @@ void GxsChannelPostItem::loadMessage(const uint32_t &token)
}
else
{
std::cerr << "GxsChannelPostItem::loadMessage() Wrong number of Items";
std::cerr << "GxsChannelPostItem::loadMessage() Wrong number of Items. Remove It.";
std::cerr << std::endl;
removeItem();
return;
}
}
void GxsChannelPostItem::loadComment(const uint32_t &token)
{
#ifdef DEBUG_ITEM
std::cerr << "GxsChannelPostItem::loadComment()";
std::cerr << std::endl;
#endif
std::vector<RsGxsComment> cmts;
if (!rsGxsChannels->getRelatedComments(token, cmts))
{
std::cerr << "GxsChannelPostItem::loadComment() ERROR getting data";
std::cerr << std::endl;
return;
}
size_t comNb = cmts.size();
QString sComButText = tr("Comment");
if (comNb == 1) {
sComButText = sComButText.append("(1)");
} else if (comNb > 1) {
sComButText = tr("Comments").append("(%1)").arg(comNb);
}
ui->commentButton->setText(sComButText);
}
void GxsChannelPostItem::fill()

View file

@ -68,8 +68,9 @@ protected:
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_CHANNEL; }
/* GxsFeedItem */
virtual void loadMessage(const uint32_t &token);
virtual QString messageName();
virtual void loadMessage(const uint32_t &token);
virtual void loadComment(const uint32_t &token);
private slots:
/* default stuff */

View file

@ -63,8 +63,9 @@ protected:
virtual bool isLoading();
/* GxsFeedItem */
virtual void loadMessage(const uint32_t &token);
virtual QString messageName();
virtual void loadMessage(const uint32_t &token);
virtual void loadComment(const uint32_t &/*token*/){ return;}
private slots:
/* default stuff */

View file

@ -38,7 +38,7 @@ void NewsFeedUserNotify::newsFeedChanged(int count)
QIcon NewsFeedUserNotify::getMainIcon(bool hasNew)
{
return hasNew ? QIcon(":/icons/knews_red_128.png") : QIcon(":/icons/knews_128.png");
return hasNew ? QIcon(":/icons/png/newsfeed-notify.png") : QIcon(":/icons/png/newsfeed.png");
}
unsigned int NewsFeedUserNotify::getNewCount()

View file

@ -31,7 +31,7 @@
#include <algorithm>
/** Default constructor */
CreateGroup::CreateGroup(const std::string &groupId, QWidget *parent)
CreateGroup::CreateGroup(const RsNodeGroupId &groupId, QWidget *parent)
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
{
/* Invoke Qt Designer generated QObject setup routine */
@ -45,13 +45,18 @@ CreateGroup::CreateGroup(const std::string &groupId, QWidget *parent)
mGroupId = groupId;
if(!mGroupId.isNull())
ui.groupId_LE->setText(QString::fromStdString(mGroupId.toStdString())) ;
else
ui.groupId_LE->setText(tr("To be defined")) ;
/* Initialize friends list */
ui.friendList->setHeaderText(tr("Friends"));
ui.friendList->setModus(FriendSelectionWidget::MODUS_CHECK);
ui.friendList->setShowType(FriendSelectionWidget::SHOW_GROUP | FriendSelectionWidget::SHOW_GPG);
ui.friendList->start();
if (mGroupId.empty() == false) {
if (!mGroupId.isNull()) {
/* edit exisiting group */
RsGroupInfo groupInfo;
if (rsPeers->getGroupInfo(mGroupId, groupInfo)) {
@ -83,7 +88,7 @@ CreateGroup::CreateGroup(const std::string &groupId, QWidget *parent)
std::list<RsGroupInfo>::iterator groupIt;
for (groupIt = groupInfoList.begin(); groupIt != groupInfoList.end(); ++groupIt) {
if (mGroupId.empty() || groupIt->id != mGroupId) {
if (mGroupId.isNull() || groupIt->id != mGroupId) {
mUsedGroupNames.append(GroupDefs::name(*groupIt));
}
}
@ -104,9 +109,9 @@ CreateGroup::~CreateGroup()
void CreateGroup::groupNameChanged(QString text)
{
if (text.isEmpty() || mUsedGroupNames.contains(misc::removeNewLine(text))) {
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
} else {
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
}
}
@ -114,14 +119,19 @@ void CreateGroup::changeGroup()
{
RsGroupInfo groupInfo;
if (mGroupId.empty()) {
if (mGroupId.isNull())
{
// add new group
groupInfo.name = misc::removeNewLine(ui.groupName->text()).toUtf8().constData();
if (!rsPeers->addGroup(groupInfo)) {
if (!rsPeers->addGroup(groupInfo))
return;
}
} else {
if (rsPeers->getGroupInfo(mGroupId, groupInfo) == true) {
}
else
{
if (rsPeers->getGroupInfo(mGroupId, groupInfo))
{
if (!mIsStandard) {
groupInfo.name = misc::removeNewLine(ui.groupName->text()).toUtf8().constData();
if (!rsPeers->editGroup(mGroupId, groupInfo)) {

View file

@ -30,7 +30,7 @@ class CreateGroup : public QDialog
public:
/** Default constructor */
CreateGroup(const std::string &groupId, QWidget *parent = 0);
CreateGroup(const RsNodeGroupId &groupId, QWidget *parent = 0);
/** Default destructor */
~CreateGroup();
@ -39,7 +39,7 @@ private slots:
void groupNameChanged(QString);
private:
std::string mGroupId;
RsNodeGroupId mGroupId;
QStringList mUsedGroupNames;
bool mIsStandard;

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>386</width>
<height>298</height>
<width>575</width>
<height>485</height>
</rect>
</property>
<property name="windowTitle">
@ -23,9 +23,6 @@
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="HeaderFrame" name="headerFrame"/>
</item>
<item row="1" column="0">
<widget class="QFrame" name="frame">
<property name="frameShape">
@ -36,27 +33,35 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="groupLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="groupLabel">
<property name="text">
<string>Group Name</string>
<string>Group Name:</string>
</property>
</widget>
</item>
<item>
<item row="0" column="1">
<widget class="QLineEdit" name="groupName">
<property name="toolTip">
<string>Enter a name for your group</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="groupId_LB">
<property name="text">
<string>Group ID:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="groupId_LE">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -79,6 +84,9 @@
</layout>
</widget>
</item>
<item row="0" column="0">
<widget class="HeaderFrame" name="headerFrame"/>
</item>
</layout>
</widget>
<customwidgets>

View file

@ -31,14 +31,13 @@
/** Constructor */
GxsCircleChooser::GxsCircleChooser(QWidget *parent)
: QComboBox(parent), mFlags(0)
: QComboBox(parent)
{
return;
}
void GxsCircleChooser::loadCircles(uint32_t chooserFlags, const RsGxsCircleId &defaultId)
void GxsCircleChooser::loadCircles(const RsGxsCircleId &defaultId)
{
mFlags = chooserFlags;
mDefaultCircleId = defaultId;
loadGxsCircles();
}
@ -68,14 +67,7 @@ bool MakeGxsCircleDesc(const RsGxsCircleId &id, QString &desc)
void GxsCircleChooser::loadGxsCircles()
{
std::list<RsGxsCircleId> ids;
if (mFlags & GXS_CIRCLE_CHOOSER_EXTERNAL)
{
rsGxsCircles->getCircleExternalIdList(ids);
}
if (mFlags & GXS_CIRCLE_CHOOSER_PERSONAL)
{
rsGxsCircles->getCirclePersonalIdList(ids);
}
rsGxsCircles->getCircleExternalIdList(ids);
if (ids.empty())
{

View file

@ -28,11 +28,6 @@
#include <QComboBox>
#include <retroshare/rsgxscircles.h>
#define GXS_CIRCLE_CHOOSER_EXTERNAL 0x0001
#define GXS_CIRCLE_CHOOSER_PERSONAL 0x0002
#define GXS_CIRCLE_CHOOSER_ALLCIRCLES 0x0003 // OR of other two.
class GxsCircleChooser : public QComboBox
{
Q_OBJECT
@ -40,12 +35,11 @@ class GxsCircleChooser : public QComboBox
public:
GxsCircleChooser(QWidget *parent = NULL);
void loadCircles(uint32_t chooserFlags, const RsGxsCircleId &defaultId);
void loadCircles(const RsGxsCircleId &defaultId);
bool getChosenCircle(RsGxsCircleId &id);
private:
void loadGxsCircles();
uint32_t mFlags;
RsGxsCircleId mDefaultCircleId;
};

View file

@ -44,6 +44,7 @@ GxsFeedItem::GxsFeedItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGro
mMessageId = messageId;
mTokenTypeMessage = nextTokenType();
mTokenTypeComment = nextTokenType();
}
GxsFeedItem::~GxsFeedItem()
@ -132,6 +133,37 @@ void GxsFeedItem::requestMessage()
mLoadQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeMessage);
}
void GxsFeedItem::requestComment()
{
#ifdef DEBUG_ITEM
std::cerr << "GxsFeedItem::requestComment()";
std::cerr << std::endl;
#endif
if (!initLoadQueue()) {
return;
}
if (mLoadQueue->activeRequestExist(mTokenTypeComment)) {
/* Request already running */
return;
}
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_MSG_RELATED_DATA;
opts.mOptions = RS_TOKREQOPT_MSG_THREAD | RS_TOKREQOPT_MSG_LATEST;
RsGxsGrpMsgIdPair msgIdPair;
msgIdPair.first = groupId();
msgIdPair.second = messageId();
std::vector<RsGxsGrpMsgIdPair> msgIds;
msgIds.push_back(msgIdPair);
uint32_t token;
mLoadQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeComment);
}
void GxsFeedItem::loadRequest(const TokenQueue *queue, const TokenRequest &req)
{
#ifdef DEBUG_ITEM
@ -144,6 +176,10 @@ void GxsFeedItem::loadRequest(const TokenQueue *queue, const TokenRequest &req)
loadMessage(req.mToken);
return;
}
if (req.mUserType == mTokenTypeComment) {
loadComment(req.mToken);
return;
}
}
GxsGroupFeedItem::loadRequest(queue, req);

View file

@ -42,9 +42,11 @@ public:
protected:
/* load message data */
void requestMessage();
void requestComment();
virtual void loadMessage(const uint32_t &token) = 0;
virtual QString messageName() = 0;
virtual void loadMessage(const uint32_t &token) = 0;
virtual void loadComment(const uint32_t &token) = 0;
/* GxsGroupFeedItem */
virtual bool isLoading();
@ -60,6 +62,7 @@ protected slots:
private:
RsGxsMessageId mMessageId;
uint32_t mTokenTypeMessage;
uint32_t mTokenTypeComment;
};
Q_DECLARE_METATYPE(RsGxsMessageId)

View file

@ -124,8 +124,8 @@ void GxsGroupDialog::init()
/* Setup Reasonable Defaults */
ui.idChooser->loadIds(0,RsGxsId());
ui.circleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_EXTERNAL, RsGxsCircleId());
ui.localComboBox->loadCircles(GXS_CIRCLE_CHOOSER_PERSONAL, RsGxsCircleId());
ui.circleComboBox->loadCircles(RsGxsCircleId());
ui.localComboBox->loadGroups(0, RsNodeGroupId());
ui.groupDesc->setPlaceholderText(tr("Set a descriptive description here"));
@ -301,8 +301,12 @@ void GxsGroupDialog::setupDefaults()
ui.commentsValueLabel->setText(tr("Allowed"));
}
}
ui.antiSpam_trackMessages->setChecked((bool)(mDefaultsFlags & GXS_GROUP_DEFAULTS_ANTISPAM_TRACK));
ui.antiSpam_signedIds->setChecked((bool)(mDefaultsFlags & GXS_GROUP_DEFAULTS_ANTISPAM_FAVOR_PGP));
if( (mDefaultsFlags & GXS_GROUP_DEFAULTS_ANTISPAM_FAVOR_PGP) && (mDefaultsFlags & GXS_GROUP_DEFAULTS_ANTISPAM_FAVOR_PGP_KNOWN))
ui.antiSpam_perms_CB->setCurrentIndex(2) ;
else if(mDefaultsFlags & GXS_GROUP_DEFAULTS_ANTISPAM_FAVOR_PGP)
ui.antiSpam_perms_CB->setCurrentIndex(1) ;
else
ui.antiSpam_perms_CB->setCurrentIndex(0) ;
QString antispam_string ;
if(mDefaultsFlags & GXS_GROUP_DEFAULTS_ANTISPAM_TRACK) antispam_string += tr("Message tracking") ;
@ -315,8 +319,6 @@ void GxsGroupDialog::setupDefaults()
ui.typeGroup_3->setEnabled(false);
ui.typeLocal_3->setEnabled(false);
#endif
ui.typeLocal->setEnabled(false); // for now, since local circles not fully tested.
ui.typeLocal->setToolTip(tr("This feature is not yet available, but it will be available very soon!")); // for now, since local circles not fully tested.
}
void GxsGroupDialog::setupVisibility()
@ -394,85 +396,97 @@ void GxsGroupDialog::newGroup()
void GxsGroupDialog::updateFromExistingMeta(const QString &description)
{
std::cerr << "void GxsGroupDialog::updateFromExistingMeta()";
std::cerr << std::endl;
std::cerr << "void GxsGroupDialog::updateFromExistingMeta()";
std::cerr << std::endl;
std::cerr << "void GxsGroupDialog::updateFromExistingMeta() mGrpMeta.mCircleType: ";
std::cerr << mGrpMeta.mCircleType << " Internal: " << mGrpMeta.mInternalCircle;
std::cerr << " External: " << mGrpMeta.mCircleId;
std::cerr << std::endl;
std::cerr << "void GxsGroupDialog::updateFromExistingMeta() mGrpMeta.mCircleType: ";
std::cerr << mGrpMeta.mCircleType << " Internal: " << mGrpMeta.mInternalCircle;
std::cerr << " External: " << mGrpMeta.mCircleId;
std::cerr << std::endl;
setupDefaults();
setupVisibility();
setupReadonly();
clearForm();
setGroupSignFlags(mGrpMeta.mSignFlags) ;
setupDefaults();
setupVisibility();
setupReadonly();
clearForm();
setGroupSignFlags(mGrpMeta.mSignFlags) ;
/* setup name */
ui.groupName->setText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
/* Show Mode */
ui.nameline->setText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
ui.popline->setText(QString::number( mGrpMeta.mPop)) ;
ui.postsline->setText(QString::number(mGrpMeta.mVisibleMsgCount));
ui.lastpostline->setText(DateTime::formatLongDateTime(mGrpMeta.mLastPost));
/* setup name */
ui.groupName->setText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
/* Show Mode */
ui.nameline->setText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
ui.popline->setText(QString::number( mGrpMeta.mPop)) ;
ui.postsline->setText(QString::number(mGrpMeta.mVisibleMsgCount));
ui.lastpostline->setText(DateTime::formatLongDateTime(mGrpMeta.mLastPost));
ui.authorLabel->setId(mGrpMeta.mAuthorId);
ui.IDline->setText(QString::fromStdString(mGrpMeta.mGroupId.toStdString()));
ui.descriptiontextEdit->setPlainText(description);
switch (mode())
{
case MODE_CREATE:{
}
break;
case MODE_SHOW:{
ui.headerFrame->setHeaderText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
if (!mPicture.isNull())
ui.headerFrame->setHeaderImage(mPicture);
}
break;
case MODE_EDIT:{
}
break;
}
/* set description */
ui.groupDesc->setPlainText(description);
QString distribution_string = "[Unknown]";
ui.IDline->setText(QString::fromStdString(mGrpMeta.mGroupId.toStdString()));
ui.descriptiontextEdit->setPlainText(description);
switch(mGrpMeta.mCircleType)
{
case GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY:
ui.typeLocal->setChecked(true);
distribution_string = tr("Your friends only") ;
ui.localComboBox->loadCircles(GXS_CIRCLE_CHOOSER_PERSONAL, mGrpMeta.mInternalCircle);
ui.distributionCircleComboBox->setVisible(true) ;
ui.distributionCircleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_PERSONAL, mGrpMeta.mInternalCircle);
break;
case GXS_CIRCLE_TYPE_PUBLIC:
ui.typePublic->setChecked(true);
distribution_string = tr("Public") ;
ui.distributionCircleComboBox->setVisible(false) ;
break;
case GXS_CIRCLE_TYPE_EXTERNAL:
ui.typeGroup->setChecked(true);
distribution_string = tr("Restricted to circle:") ;
ui.distributionCircleComboBox->setVisible(true) ;
ui.distributionCircleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_EXTERNAL, mGrpMeta.mCircleId);
ui.circleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_EXTERNAL, mGrpMeta.mCircleId);
break;
default:
std::cerr << "CreateCircleDialog::updateCircleGUI() INVALID mCircleType";
std::cerr << std::endl;
break;
}
switch (mode())
{
case MODE_CREATE:{
}
break;
case MODE_SHOW:{
ui.headerFrame->setHeaderText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
if (!mPicture.isNull())
ui.headerFrame->setHeaderImage(mPicture);
}
break;
case MODE_EDIT:{
}
break;
}
/* set description */
ui.groupDesc->setPlainText(description);
QString distribution_string = "[Unknown]";
switch(mGrpMeta.mCircleType)
{
case GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY:
{
ui.typeLocal->setChecked(true);
distribution_string = tr("Only friends nodes in group ") ;
RsGroupInfo ginfo ;
rsPeers->getGroupInfo(RsNodeGroupId(mGrpMeta.mInternalCircle),ginfo) ;
QString desc;
GroupChooser::makeNodeGroupDesc(ginfo, desc);
distribution_string += desc ;
ui.localComboBox->loadGroups(0, RsNodeGroupId(mGrpMeta.mInternalCircle));
ui.distributionCircleComboBox->setVisible(false) ;
ui.localComboBox->setVisible(true) ;
}
break;
case GXS_CIRCLE_TYPE_PUBLIC:
ui.typePublic->setChecked(true);
distribution_string = tr("Public") ;
ui.distributionCircleComboBox->setVisible(false) ;
ui.localComboBox->setVisible(false) ;
break;
case GXS_CIRCLE_TYPE_EXTERNAL:
ui.typeGroup->setChecked(true);
distribution_string = tr("Restricted to circle:") ;
ui.localComboBox->setVisible(false) ;
ui.distributionCircleComboBox->setVisible(true) ;
ui.distributionCircleComboBox->loadCircles(mGrpMeta.mCircleId);
ui.circleComboBox->loadCircles(mGrpMeta.mCircleId);
break;
default:
std::cerr << "CreateCircleDialog::updateCircleGUI() INVALID mCircleType";
std::cerr << std::endl;
break;
}
ui.distributionValueLabel->setText(distribution_string) ;
ui.idChooser->loadIds(0, mGrpMeta.mAuthorId);
if(!mGrpMeta.mAuthorId.isNull())
ui.idChooser->setChosenId(mGrpMeta.mAuthorId) ;
ui.idChooser->loadIds(0, mGrpMeta.mAuthorId);
updateCircleOptions();
if(!mGrpMeta.mAuthorId.isNull())
ui.idChooser->setChosenId(mGrpMeta.mAuthorId) ;
updateCircleOptions();
}
void GxsGroupDialog::submitGroup()
@ -613,32 +627,34 @@ void GxsGroupDialog::createGroup()
uint32_t GxsGroupDialog::getGroupSignFlags()
{
/* grab from the ui options -> */
uint32_t signFlags = 0;
if (ui.publish_encrypt->isChecked()) {
signFlags |= GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_ENCRYPTED;
} else if (ui.publish_required->isChecked()) {
signFlags |= GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_ALLSIGNED;
} else if (ui.publish_threads->isChecked()) {
signFlags |= GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_THREADHEAD;
} else { // publish_open (default).
signFlags |= GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_NONEREQ;
}
/* grab from the ui options -> */
uint32_t signFlags = 0;
if (ui.publish_encrypt->isChecked()) {
signFlags |= GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_ENCRYPTED;
} else if (ui.publish_required->isChecked()) {
signFlags |= GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_ALLSIGNED;
} else if (ui.publish_threads->isChecked()) {
signFlags |= GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_THREADHEAD;
} else { // publish_open (default).
signFlags |= GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_NONEREQ;
}
if (ui.personal_required->isChecked())
signFlags |= GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_REQUIRED;
if (ui.personal_ifnopub->isChecked())
signFlags |= GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN;
// Author Signature.
if (ui.antiSpam_signedIds->isChecked())
signFlags |= GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG;
if (ui.antiSpam_trackMessages->isChecked())
signFlags |= GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES;
return signFlags;
if (ui.personal_required->isChecked())
signFlags |= GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_REQUIRED;
if (ui.personal_ifnopub->isChecked())
signFlags |= GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN;
// Author Signature.
switch(ui.antiSpam_perms_CB->currentIndex())
{
case 0: break ;
case 2: signFlags |= GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG_KNOWN; // no break below, since we want *both* flags in this case.
case 1: signFlags |= GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG;
break ;
}
return signFlags;
}
void GxsGroupDialog::setGroupSignFlags(uint32_t signFlags)
@ -659,12 +675,18 @@ void GxsGroupDialog::setGroupSignFlags(uint32_t signFlags)
if (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN)
ui.personal_ifnopub->setChecked(true);
ui.antiSpam_trackMessages ->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES) );
ui.antiSpam_signedIds ->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) );
if( (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG_KNOWN) && (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG))
ui.antiSpam_perms_CB->setCurrentIndex(2) ;
else if(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG)
ui.antiSpam_perms_CB->setCurrentIndex(1) ;
else
ui.antiSpam_perms_CB->setCurrentIndex(0) ;
QString antispam_string ;
if(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES) antispam_string += tr("Message tracking") ;
if(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) antispam_string += (antispam_string.isNull()?"":" and ")+tr("PGP signature required") ;
if(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG_KNOWN) antispam_string += (antispam_string.isNull()?"":" and ")+tr("PGP signature from known ID required") ;
else
if(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) antispam_string += (antispam_string.isNull()?"":" and ")+tr("PGP signature required") ;
ui.antiSpamValueLabel->setText(antispam_string) ;
//ui.antiSpam_trackMessages_2->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES) );
@ -720,41 +742,42 @@ void GxsGroupDialog::updateCircleOptions()
bool GxsGroupDialog::setCircleParameters(RsGroupMetaData &meta)
{
meta.mCircleType = GXS_CIRCLE_TYPE_PUBLIC;
meta.mCircleId.clear();
meta.mOriginator.clear();
meta.mInternalCircle.clear();
meta.mCircleType = GXS_CIRCLE_TYPE_PUBLIC;
meta.mCircleId.clear();
meta.mOriginator.clear();
meta.mInternalCircle.clear();
if (ui.typePublic->isChecked())
{
meta.mCircleType = GXS_CIRCLE_TYPE_PUBLIC;
meta.mCircleId.clear();
}
else if (ui.typeGroup->isChecked())
{
meta.mCircleType = GXS_CIRCLE_TYPE_EXTERNAL;
if (!ui.circleComboBox->getChosenCircle(meta.mCircleId))
{
return false;
}
}
else if (ui.typeLocal->isChecked())
{
meta.mCircleType = GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY;
meta.mCircleId.clear();
meta.mOriginator.clear();
meta.mInternalCircle.clear() ;
if (!ui.localComboBox->getChosenCircle(meta.mInternalCircle))
{
return false;
}
}
else
{
return false;
}
return true;
if (ui.typePublic->isChecked())
{
meta.mCircleType = GXS_CIRCLE_TYPE_PUBLIC;
meta.mCircleId.clear();
}
else if (ui.typeGroup->isChecked())
{
meta.mCircleType = GXS_CIRCLE_TYPE_EXTERNAL;
if (!ui.circleComboBox->getChosenCircle(meta.mCircleId))
{
return false;
}
}
else if (ui.typeLocal->isChecked())
{
meta.mCircleType = GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY;
meta.mCircleId.clear();
meta.mOriginator.clear();
meta.mInternalCircle.clear() ;
RsNodeGroupId ngi ;
if (!ui.localComboBox->getChosenGroup(ngi))
return false;
meta.mInternalCircle = RsGxsCircleId(ngi) ;
}
else
return false;
return true;
}
void GxsGroupDialog::cancelDialog()

View file

@ -90,8 +90,9 @@ public:
#define GXS_GROUP_DEFAULTS_COMMENTS_YES 0x00001000
#define GXS_GROUP_DEFAULTS_COMMENTS_NO 0x00002000
#define GXS_GROUP_DEFAULTS_ANTISPAM_FAVOR_PGP 0x00100000
#define GXS_GROUP_DEFAULTS_ANTISPAM_TRACK 0x00200000
#define GXS_GROUP_DEFAULTS_ANTISPAM_FAVOR_PGP 0x00100000
#define GXS_GROUP_DEFAULTS_ANTISPAM_TRACK 0x00200000
#define GXS_GROUP_DEFAULTS_ANTISPAM_FAVOR_PGP_KNOWN 0x00400000
/*!
* The aim of this dialog is to be convenient to encapsulate group

File diff suppressed because it is too large Load diff

View file

@ -29,7 +29,6 @@
#include <math.h>
#include "GxsIdDetails.h"
#include "retroshare-gui/RsAutoUpdatePage.h"
#include "retroshare/rsreputations.h"
#include <retroshare/rspeers.h>
@ -905,7 +904,7 @@ bool GxsIdDetails::MakeIdDesc(const RsGxsId &id, bool doIcons, QString &str, QLi
QString GxsIdDetails::getName(const RsIdentityDetails &details)
{
if(rsReputations->isIdentityBanned(details.mId))
if(rsIdentity->isBanned(details.mId))
return tr("[Banned]") ;
QString name = QString::fromUtf8(details.mNickname.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE);
@ -924,7 +923,7 @@ QString GxsIdDetails::getComment(const RsIdentityDetails &details)
QString comment;
QString nickname ;
bool banned = rsReputations->isIdentityBanned(details.mId) ;
bool banned = rsIdentity->isBanned(details.mId) ;
if(details.mNickname.empty())
nickname = tr("[Unknown]") ;
@ -963,7 +962,7 @@ void GxsIdDetails::getIcons(const RsIdentityDetails &details, QList<QIcon> &icon
{
QPixmap pix ;
if(rsReputations->isIdentityBanned(details.mId))
if(rsIdentity->isBanned(details.mId))
{
icons.clear() ;
icons.push_back(QIcon(IMAGE_BANNED)) ;

View file

@ -25,7 +25,6 @@
#include "GxsIdTreeWidgetItem.h"
#include "GxsIdDetails.h"
#include "util/HandleRichText.h"
#include "retroshare/rsreputations.h"
#define BANNED_IMAGE ":/icons/yellow_biohazard64.png"
@ -117,14 +116,14 @@ void GxsIdRSTreeWidgetItem::setId(const RsGxsId &id, int column, bool retryWhenF
void GxsIdRSTreeWidgetItem::updateBannedState()
{
if(mBannedState != rsReputations->isIdentityBanned(mId))
if(mBannedState != rsIdentity->isBanned(mId))
forceUpdate() ;
}
void GxsIdRSTreeWidgetItem::forceUpdate()
{
mIdFound = false;
mBannedState = rsReputations->isIdentityBanned(mId) ;
mBannedState = rsIdentity->isBanned(mId) ;
startProcess();
}
@ -170,7 +169,7 @@ QVariant GxsIdRSTreeWidgetItem::data(int column, int role) const
if(mId.isNull())
return RSTreeWidgetItem::data(column, role);
else if(rsReputations->isIdentityBanned(mId))
else if(rsIdentity->isBanned(mId))
pix = QImage(BANNED_IMAGE) ;
else if (mAvatar.mSize == 0 || !pix.loadFromData(mAvatar.mData, mAvatar.mSize, "PNG"))
pix = GxsIdDetails::makeDefaultIcon(mId);

View file

@ -105,9 +105,9 @@ QString GxsChannelDialog::icon(IconType type)
{
switch (type) {
case ICON_NAME:
return ":/images/channels24.png";
return ":/icons/png/channels.png";
case ICON_NEW:
return ":/images/add_channel24.png";
return ":/icons/png/add.png";
case ICON_YOUR_GROUP:
return ":/images/folder16.png";
case ICON_SUBSCRIBED_GROUP:

View file

@ -24,7 +24,7 @@
#include "gui/gxs/GxsGroupFrameDialog.h"
#define IMAGE_GXSCHANNELS ":/images/channels.png"
#define IMAGE_GXSCHANNELS ":/icons/png/channels.png"
class GxsChannelDialog : public GxsGroupFrameDialog
{

View file

@ -95,11 +95,11 @@ QPixmap GxsChannelGroupDialog::serviceImage()
switch (mode())
{
case MODE_CREATE:
return QPixmap(":/images/add_channel64.png");
return QPixmap(":/icons/png/channels.png");
case MODE_SHOW:
return QPixmap(":/images/channels.png");
return QPixmap(":/icons/png/channels.png");
case MODE_EDIT:
return QPixmap(":/images/channels.png");
return QPixmap(":/icons/png/channels.png");
}
return QPixmap();

View file

@ -37,12 +37,12 @@ bool GxsChannelUserNotify::hasSetting(QString *name, QString *group)
QIcon GxsChannelUserNotify::getIcon()
{
return QIcon(":/images/channels16.png");
return QIcon(":/icons/png/channels.png");
}
QIcon GxsChannelUserNotify::getMainIcon(bool hasNew)
{
return hasNew ? QIcon(":/icons/channels_red_128.png") : QIcon(":/icons/channels_128.png");
return hasNew ? QIcon(":/icons/png/channels-notify.png") : QIcon(":/icons/png/channels.png");
}
void GxsChannelUserNotify::iconClicked()

View file

@ -212,7 +212,7 @@ void CreateGxsForumMsg::loadFormInformation()
//std::cerr << "CreateGxsForumMsg::loadMsgInformation() using signFlags=" << std::hex << mForumMeta.mSignFlags << std::dec << std::endl;
if(mForumMeta.mSignFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG)
if( (mForumMeta.mSignFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) || (mForumMeta.mSignFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG_KNOWN))
ui.idChooser->setFlags(IDCHOOSER_ID_REQUIRED | IDCHOOSER_NON_ANONYMOUS) ;
else
ui.idChooser->setFlags(IDCHOOSER_ID_REQUIRED) ;

View file

@ -91,7 +91,7 @@ void GxsForumGroupDialog::initUi()
QPixmap GxsForumGroupDialog::serviceImage()
{
return QPixmap(":/images/konversation64.png");
return QPixmap(":/icons/png/forums.png");
}
bool GxsForumGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta)

View file

@ -44,7 +44,6 @@
#include <retroshare/rsgxsforums.h>
#include <retroshare/rsgrouter.h>
#include <retroshare/rsreputations.h>
#include <retroshare/rspeers.h>
// These should be in retroshare/ folder.
#include "retroshare/rsgxsflags.h"
@ -578,17 +577,6 @@ void GxsForumThreadWidget::changedThread()
mThreadId = RsGxsMessageId(item->data(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID).toString().toStdString());
}
// Show info about who passed on this message.
if(mForumGroup.mMeta.mSignFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES)
{
RsPeerId providerId ;
std::string msgId = item->data(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID).toString().toStdString();
RsGxsMessageId mid(msgId) ;
if(rsGRouter->getTrackingInfo(mid,providerId) && !providerId.isNull() )
item->setToolTip(COLUMN_THREAD_TITLE,tr("This message was obtained from %1").arg(QString::fromUtf8(rsPeers->getPeerName(providerId).c_str())));
}
if (mFillThread) {
return;
}
@ -791,11 +779,9 @@ void GxsForumThreadWidget::insertGroupData()
tw->ui->forumName->setText(QString::fromUtf8(group.mMeta.mGroupName.c_str()));
QString anti_spam_features1 ;
if(IS_GROUP_PGP_AUTHED(tw->mSignFlags)) anti_spam_features1 = tr("Anonymous IDs reputation threshold set to 0.4");
if(IS_GROUP_PGP_KNOWN_AUTHED(tw->mSignFlags)) anti_spam_features1 = tr("Anonymous/unknown node IDs reputation threshold set to 0.4");
else if(IS_GROUP_PGP_AUTHED(tw->mSignFlags)) anti_spam_features1 = tr("Anonymous IDs reputation threshold set to 0.4");
QString anti_spam_features2 ;
if(IS_GROUP_MESSAGE_TRACKING(tw->mSignFlags)) anti_spam_features2 = tr("Message routing info kept for 10 days");
tw->mForumDescription = QString("<b>%1: \t</b>%2<br/>").arg(tr("Forum name"), QString::fromUtf8( group.mMeta.mGroupName.c_str()));
tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Subscribers")).arg(group.mMeta.mPop);
tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Posts (at neighbor nodes)")).arg(group.mMeta.mVisibleMsgCount);
@ -817,9 +803,20 @@ void GxsForumThreadWidget::insertGroupData()
distrib_string = tr("Restricted to members of circle ")+QString::fromStdString(group.mMeta.mCircleId.toStdString()) ;
}
break ;
case GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY: distrib_string = tr("Your eyes only");
break ;
case GXS_CIRCLE_TYPE_LOCAL: distrib_string = tr("You and your friend nodes");
case GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY:
{
distrib_string = tr("Only friends nodes in group ") ;
RsGroupInfo ginfo ;
rsPeers->getGroupInfo(RsNodeGroupId(group.mMeta.mInternalCircle),ginfo) ;
QString desc;
GroupChooser::makeNodeGroupDesc(ginfo, desc);
distrib_string += desc ;
}
break ;
case GXS_CIRCLE_TYPE_LOCAL: distrib_string = tr("Your eyes only"); // this is not yet supported. If you see this, it is a bug!
break ;
default:
std::cerr << "(EE) badly initialised group distribution ID = " << group.mMeta.mCircleType << std::endl;
@ -831,9 +828,6 @@ void GxsForumThreadWidget::insertGroupData()
if(!anti_spam_features1.isNull())
tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Anti-spam")).arg(anti_spam_features1);
if(!anti_spam_features2.isNull())
tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Anti-spam")).arg(anti_spam_features2);
tw->mForumDescription += QString("<b>%1: </b><br/><br/>%2").arg(tr("Description"), QString::fromUtf8(group.mDescription.c_str()));
tw->ui->subscribeToolButton->setSubscribed(IS_GROUP_SUBSCRIBED(tw->mSubscribeFlags));
@ -979,44 +973,54 @@ void GxsForumThreadWidget::fillThreadStatus(QString text)
ui->progressText->setText(text);
}
QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForumMsg &msg, bool useChildTS, uint32_t filterColumn)
QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForumMsg &msg, bool useChildTS, uint32_t filterColumn, QTreeWidgetItem *parent)
{
// Early check for a message that should be hidden because its author
// is flagged with a bad reputation
bool redacted = rsReputations->isIdentityBanned(msg.mMeta.mAuthorId) ;
GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(mThreadCompareRole,GxsIdDetails::ICON_TYPE_ALL || (redacted?(GxsIdDetails::ICON_TYPE_REDACTED):0));
// Early check for a message that should be hidden because its author
// is flagged with a bad reputation
bool redacted = rsIdentity->isBanned(msg.mMeta.mAuthorId) ;
GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(mThreadCompareRole,GxsIdDetails::ICON_TYPE_ALL || (redacted?(GxsIdDetails::ICON_TYPE_REDACTED):0));
item->moveToThread(ui->threadTreeWidget->thread());
QString text;
if(redacted)
if(redacted)
item->setText(COLUMN_THREAD_TITLE, tr("[ ... Redacted message ... ]"));
else
item->setText(COLUMN_THREAD_TITLE, QString::fromUtf8(msg.mMeta.mMsgName.c_str()));
//msg.mMeta.mChildTs Was not updated when received new child
// so do it here.
QDateTime qtime;
QString sort;
qtime.setTime_t(msg.mMeta.mPublishTs);
if (useChildTS)
qtime.setTime_t(msg.mMeta.mChildTs);
else
qtime.setTime_t(msg.mMeta.mPublishTs);
text = DateTime::formatDateTime(qtime);
sort = qtime.toString("yyyyMMdd_hhmmss");
QString itemText = DateTime::formatDateTime(qtime);
QString itemSort = QString::number(msg.mMeta.mPublishTs);//Don't need to format it as for sort.
if (useChildTS)
{
qtime.setTime_t(msg.mMeta.mPublishTs);
text += " / ";
text += DateTime::formatDateTime(qtime);
sort += "_" + qtime.toString("yyyyMMdd_hhmmss");
for(QTreeWidgetItem *grandParent = parent; grandParent!=NULL; grandParent = grandParent->parent())
{
//Update Parent Child TimeStamp
QString oldTSText = grandParent->text(COLUMN_THREAD_DATE);
QString oldTSSort = grandParent->data(COLUMN_THREAD_DATE, ROLE_THREAD_SORT).toString();
QString oldCTSText = oldTSText.split("|").at(0);
QString oldPTSText = oldTSText.contains("|") ? oldTSText.split(" | ").at(1) : oldCTSText;//If first time parent get only its mPublishTs
QString oldCTSSort = oldTSSort.split("|").at(0);
QString oldPTSSort = oldTSSort.contains("|") ? oldTSSort.split(" | ").at(1) : oldCTSSort;
if (oldCTSSort.toDouble() < itemSort.toDouble())
{
grandParent->setText(COLUMN_THREAD_DATE, DateTime::formatDateTime(qtime) + " | " + oldPTSText);
grandParent->setData(COLUMN_THREAD_DATE, ROLE_THREAD_SORT, itemSort + " | " + oldPTSSort);
}
}
}
item->setText(COLUMN_THREAD_DATE, text);
item->setData(COLUMN_THREAD_DATE, ROLE_THREAD_SORT, sort);
item->setText(COLUMN_THREAD_DATE, itemText);
item->setData(COLUMN_THREAD_DATE, ROLE_THREAD_SORT, itemSort);
// Set later with GxsIdRSTreeWidgetItem::setId
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_AUTHOR, QString::fromStdString(msg.mMeta.mAuthorId.toStdString()));
@ -1067,7 +1071,8 @@ QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForum
#endif
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS, msg.mMeta.mMsgStatus);
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MISSING, false);
if (parent) parent->addChild(item);
return item;
}
@ -1408,7 +1413,7 @@ void GxsForumThreadWidget::insertMessageData(const RsGxsForumMsg &msg)
return;
}
bool redacted = rsReputations->isIdentityBanned(msg.mMeta.mAuthorId) ;
bool redacted = rsIdentity->isBanned(msg.mMeta.mAuthorId) ;
mStateHelper->setActive(mTokenTypeMessageData, true);

View file

@ -51,7 +51,7 @@ public:
unsigned int newCount() { return mNewCount; }
unsigned int unreadCount() { return mUnreadCount; }
QTreeWidgetItem *convertMsgToThreadWidget(const RsGxsForumMsg &msg, bool useChildTS, uint32_t filterColumn);
QTreeWidgetItem *convertMsgToThreadWidget(const RsGxsForumMsg &msg, bool useChildTS, uint32_t filterColumn, QTreeWidgetItem *parent = NULL);
QTreeWidgetItem *generateMissingItem(const RsGxsMessageId &msgId);
// Callback for all Loads.

View file

@ -38,12 +38,12 @@ bool GxsForumUserNotify::hasSetting(QString *name, QString *group)
QIcon GxsForumUserNotify::getIcon()
{
return QIcon(":/icons/konversation_128.png");
return QIcon(":/icons/png/forums.png");
}
QIcon GxsForumUserNotify::getMainIcon(bool hasNew)
{
return hasNew ? QIcon(":/icons/konversation_red_128.png") : QIcon(":/icons/konversation_128.png");
return hasNew ? QIcon(":/icons/png/forums-notify.png") : QIcon(":/icons/png/forums.png");
}
void GxsForumUserNotify::iconClicked()

View file

@ -104,9 +104,9 @@ QString GxsForumsDialog::icon(IconType type)
{
switch (type) {
case ICON_NAME:
return ":/images/konversation.png";
return ":/icons/png/forums.png";
case ICON_NEW:
return ":/images/new_forum16.png";
return ":/icons/png/add.png";
case ICON_YOUR_GROUP:
return ":/images/folder16.png";
case ICON_SUBSCRIBED_GROUP:

View file

@ -24,7 +24,7 @@
#include "gui/gxs/GxsGroupFrameDialog.h"
#define IMAGE_GXSFORUMS ":/images/konversation.png"
#define IMAGE_GXSFORUMS ":/icons/png/forums.png"
class GxsForumsDialog : public GxsGroupFrameDialog
{

View file

@ -218,8 +218,7 @@ void GxsForumsFillThread::run()
std::cerr << "GxsForumsFillThread::run() adding " << msg.mMeta.mMsgId << std::endl;
#endif
QTreeWidgetItem *item = mParent->convertMsgToThreadWidget(msg, mUseChildTS, mFilterColumn);
threadPair.second->addChild(item);
QTreeWidgetItem *item = mParent->convertMsgToThreadWidget(msg, mUseChildTS, mFilterColumn, threadPair.second);
calculateExpand(msg, item);

View file

@ -42,6 +42,16 @@ href="http://www.gnu.org/licenses/gpl.html">http://www.gnu.org/licenses/gpl.html
<p></p>
<h2>Retroshare Icons</h2>
<p>Oxygen Icons Set(LGPL) </p>
<p>Crystal Project Icons(LGPL)</p>
<div>Icons made by <a href="http://www.freepik.com" title="Freepik">Freepik</a> from <a href="http://www.flaticon.com" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div>
<div>Icons made by <a href="http://www.flaticon.com/authors/eleonor-wang" title="Eleonor Wang">Eleonor Wang</a> from <a href="http://www.flaticon.com" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div>
<p></p>
<h2>GNU GENERAL PUBLIC LICENSE</h2>

Some files were not shown because too many files have changed in this diff Show more