merged with upstream

This commit is contained in:
csoler 2016-02-10 00:00:21 -05:00
commit 3db3ccf636
185 changed files with 61045 additions and 37839 deletions

View file

@ -26,16 +26,16 @@
#include "rshare.h"
#include "SearchDialog.h"
#include "RetroShareLink.h"
#include "msgs/MessageComposer.h"
#include "gui/RSHumanReadableDelegate.h"
#include "gui/RetroShareLink.h"
#include "retroshare-gui/RsAutoUpdatePage.h"
#include "gui/msgs/MessageComposer.h"
#include "gui/common/RsCollectionFile.h"
#include "gui/common/FilesDefs.h"
#include <gui/common/RsUrlHandler.h>
#include "settings/rsharesettings.h"
#include "advsearch/advancedsearchdialog.h"
#include "common/RSTreeWidgetItem.h"
#include "gui/common/RsUrlHandler.h"
#include "gui/settings/rsharesettings.h"
#include "gui/advsearch/advancedsearchdialog.h"
#include "gui/common/RSTreeWidgetItem.h"
#include "util/QtVersion.h"
#include <retroshare/rsfiles.h>
@ -857,7 +857,7 @@ void SearchDialog::searchKeywords(const QString& keywords)
req_id = rsTurtle->turtleSearch(lin_exp) ;
}
else
req_id = ((((uint32_t)rand()) << 16)^0x1e2fd5e4) + (((uint32_t)rand())^0x1b19acfe) ; // generate a random 32 bits request id
req_id = RSRandom::random_u32() ; // generate a random 32 bits request id
initSearchResult(keywords,req_id, ui.FileTypeComboBox->currentIndex(), false) ; // this will act before turtle results come to the interface, thanks to the signals scheduling policy.

View file

@ -43,7 +43,7 @@
#include "DLListDelegate.h"
#include "ULListDelegate.h"
#include "FileTransferInfoWidget.h"
#include <gui/SearchDialog.h>
#include <gui/FileTransfer/SearchDialog.h>
#include <gui/SharedFilesDialog.h>
#include "xprogressbar.h"
#include <gui/settings/rsharesettings.h>

View file

@ -87,7 +87,26 @@
#define RSID_FILTER_ALL 0xffff
#define IMAGE_EDIT ":/images/edit_16.png"
// quick solution for RSID_COL_VOTES sorting
class TreeWidgetItem : public QTreeWidgetItem {
public:
TreeWidgetItem(int type=Type): QTreeWidgetItem(type) {}
TreeWidgetItem(QTreeWidget *tree): QTreeWidgetItem(tree) {}
TreeWidgetItem(const QStringList& strings): QTreeWidgetItem (strings) {}
bool operator< (const QTreeWidgetItem& other ) const {
int column = treeWidget()->sortColumn();
const QVariant v1 = data(column, Qt::DisplayRole);
const QVariant v2 = other.data(column, Qt::DisplayRole);
double value1 = v1.toDouble();
double value2 = v2.toDouble();
if (value1 != value2) {
return value1 < value2;
}
else {
return (v1.toString().compare (v2.toString(), Qt::CaseInsensitive) < 0);
}
}
};
/** Constructor */
IdDialog::IdDialog(QWidget *parent) :
RsGxsUpdateBroadcastPage(rsIdentity, parent),
@ -637,7 +656,7 @@ bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item,
return false;
if (!item)
item = new QTreeWidgetItem();
item = new TreeWidgetItem();
RsReputations::ReputationInfo info ;
rsReputations->getReputationInfo(RsGxsId(data.mMeta.mGroupId),info) ;
@ -1225,105 +1244,133 @@ void IdDialog::loadRequest(const TokenQueue * queue, const TokenRequest &req)
void IdDialog::IdListCustomPopupMenu( QPoint )
{
QMenu contextMnu( this );
QMenu contextMnu( this );
std::list<RsGxsId> own_identities ;
rsIdentity->getOwnIds(own_identities) ;
std::list<RsGxsId> own_identities ;
rsIdentity->getOwnIds(own_identities) ;
QTreeWidgetItem *item = ui->idTreeWidget->currentItem();
if(item != allItem && item != contactsItem) {
uint32_t item_flags = item->data(RSID_COL_KEYID,Qt::UserRole).toUInt() ;
// make some stats about what's selected. If the same value is used for all selected items, it can be switched.
if(!(item_flags & RSID_FILTER_OWNED_BY_YOU))
{
if(own_identities.size() <= 1)
{
QAction *action = contextMnu.addAction(QIcon(":/images/chat_24.png"), tr("Chat with this person"), this, SLOT(chatIdentity()));
QList<QTreeWidgetItem *> selected_items = ui->idTreeWidget->selectedItems();
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...")) ;
bool root_node_present = false ;
bool one_item_owned_by_you = false ;
uint32_t n_positive_reputations = 0 ;
uint32_t n_negative_reputations = 0 ;
uint32_t n_neutral_reputations = 0 ;
uint32_t n_is_a_contact = 0 ;
uint32_t n_is_not_a_contact = 0 ;
uint32_t n_selected_items =0 ;
for(std::list<RsGxsId>::const_iterator it=own_identities.begin();it!=own_identities.end();++it)
{
RsIdentityDetails idd ;
rsIdentity->getIdDetails(*it,idd) ;
for(QList<QTreeWidgetItem*>::const_iterator it(selected_items.begin());it!=selected_items.end();++it)
{
if(*it == allItem || *it == contactsItem)
{
root_node_present = true ;
continue ;
}
QPixmap pixmap ;
uint32_t item_flags = (*it)->data(RSID_COL_KEYID,Qt::UserRole).toUInt() ;
if(idd.mAvatar.mSize == 0 || !pixmap.loadFromData(idd.mAvatar.mData, idd.mAvatar.mSize, "PNG"))
pixmap = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(*it)) ;
if(item_flags & RSID_FILTER_OWNED_BY_YOU)
one_item_owned_by_you = true ;
std::cerr << " item flags = " << item_flags << std::endl;
RsGxsId keyId((*it)->text(RSID_COL_KEYID).toStdString());
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())) ;
}
}
RsReputations::ReputationInfo info ;
rsReputations->getReputationInfo(keyId,info) ;
contextMnu.addAction(QIcon(":/images/mail_new.png"), tr("Send message to this person"), this, SLOT(sendMsg()));
contextMnu.addSeparator();
switch(info.mOwnOpinion)
{
case RsReputations::OPINION_NEGATIVE: ++n_negative_reputations ;
break ;
case RsReputations::OPINION_POSITIVE: ++n_positive_reputations ;
break ;
case RsReputations::OPINION_NEUTRAL: ++n_neutral_reputations ;
break ;
}
RsIdentityDetails details;
std::string keyId = item->text(RSID_COL_KEYID).toStdString();
++n_selected_items ;
rsIdentity->getIdDetails(RsGxsId(keyId), details);
QAction *addContact = contextMnu.addAction(QIcon(), tr("Add to Contacts"), this, SLOT(addtoContacts()));
QAction *removeContact = contextMnu.addAction(QIcon(":/images/cancel.png"), tr("Remove from Contacts"), this, SLOT(removefromContacts()));
if(rsIdentity->isARegularContact(keyId))
++n_is_a_contact ;
else
++n_is_not_a_contact ;
}
if(details.mFlags & RS_IDENTITY_FLAGS_IS_A_CONTACT)
{
addContact->setVisible(false);
removeContact->setVisible(true);
}
else
{
addContact->setVisible(true);
removeContact->setVisible(false);
}
contextMnu.addSeparator();
if(root_node_present) // don't show menu if some of the root nodes are present
return ;
RsReputations::ReputationInfo info ;
std::string Id = item->text(RSID_COL_KEYID).toStdString();
rsReputations->getReputationInfo(RsGxsId(Id),info) ;
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()));
QAction *banaction = contextMnu.addAction(QIcon(":/images/denied16.png"), tr("Ban this person"), this, SLOT(banPerson()));
QAction *unbanaction = contextMnu.addAction(QIcon(), tr("Unban this person"), this, SLOT(unbanPerson()));
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...")) ;
for(std::list<RsGxsId>::const_iterator it=own_identities.begin();it!=own_identities.end();++it)
{
RsIdentityDetails idd ;
rsIdentity->getIdDetails(*it,idd) ;
QPixmap pixmap ;
if(idd.mAvatar.mSize == 0 || !pixmap.loadFromData(idd.mAvatar.mData, idd.mAvatar.mSize, "PNG"))
pixmap = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(*it)) ;
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())) ;
}
}
// always allow to send messages
contextMnu.addAction(QIcon(":/images/mail_new.png"), tr("Send message"), this, SLOT(sendMsg()));
contextMnu.addSeparator();
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()));
contextMnu.addSeparator();
if(n_positive_reputations == 0) // only unban when all items are banned
contextMnu.addAction(QIcon(), tr("Set positive opinion"), this, SLOT(positivePerson()));
if(n_neutral_reputations == 0) // only unban when all items are banned
contextMnu.addAction(QIcon(), tr("Set neutral opinion"), this, SLOT(neutralPerson()));
if(n_negative_reputations == 0)
contextMnu.addAction(QIcon(":/images/denied16.png"), tr("Set negative opinion"), this, SLOT(negativePerson()));
}
if(one_item_owned_by_you && n_selected_items==1)
{
contextMnu.addSeparator();
contextMnu.addAction(ui->editIdentity);
contextMnu.addAction(ui->removeIdentity);
}
if(info.mAssessment == RsReputations::ASSESSMENT_BAD)
{
banaction->setVisible(false);
unbanaction->setVisible(true);
}
else
{
banaction->setVisible(true);
unbanaction->setVisible(false);
}
}
contextMnu.addSeparator();
contextMnu.addAction(ui->editIdentity);
contextMnu.addAction(ui->removeIdentity);
}
contextMnu.addSeparator();
contextMnu.exec(QCursor::pos());
contextMnu.exec(QCursor::pos());
}
void IdDialog::chatIdentity()
@ -1352,25 +1399,27 @@ void IdDialog::chatIdentity()
void IdDialog::sendMsg()
{
QTreeWidgetItem *item = ui->idTreeWidget->currentItem();
if (!item)
{
return;
}
QList<QTreeWidgetItem *> selected_items = ui->idTreeWidget->selectedItems();
MessageComposer *nMsgDialog = MessageComposer::newMsg();
if (nMsgDialog == NULL) {
return;
}
if(selected_items.empty())
return ;
std::string keyId = item->text(RSID_COL_KEYID).toStdString();
MessageComposer *nMsgDialog = MessageComposer::newMsg();
if (nMsgDialog == NULL)
return;
nMsgDialog->addRecipient(MessageComposer::TO, RsGxsId(keyId));
nMsgDialog->show();
nMsgDialog->activateWindow();
for(QList<QTreeWidgetItem*>::const_iterator it(selected_items.begin());it!=selected_items.end();++it)
{
QTreeWidgetItem *item = *it ;
std::string keyId = item->text(RSID_COL_KEYID).toStdString();
nMsgDialog->addRecipient(MessageComposer::TO, RsGxsId(keyId));
}
nMsgDialog->show();
nMsgDialog->activateWindow();
/* window will destroy itself! */
}
QString IdDialog::inviteMessage()
@ -1409,33 +1458,48 @@ void IdDialog::sendInvite()
}
void IdDialog::banPerson()
void IdDialog::negativePerson()
{
QTreeWidgetItem *item = ui->idTreeWidget->currentItem();
if (!item)
{
return;
}
QList<QTreeWidgetItem *> selected_items = ui->idTreeWidget->selectedItems();
for(QList<QTreeWidgetItem*>::const_iterator it(selected_items.begin());it!=selected_items.end();++it)
{
QTreeWidgetItem *item = *it ;
std::string Id = item->text(RSID_COL_KEYID).toStdString();
rsReputations->setOwnOpinion(RsGxsId(Id),RsReputations::OPINION_NEGATIVE) ;
}
requestIdDetails();
requestIdList();
}
void IdDialog::unbanPerson()
void IdDialog::neutralPerson()
{
QTreeWidgetItem *item = ui->idTreeWidget->currentItem();
if (!item)
{
return;
}
QList<QTreeWidgetItem *> selected_items = ui->idTreeWidget->selectedItems();
for(QList<QTreeWidgetItem*>::const_iterator it(selected_items.begin());it!=selected_items.end();++it)
{
QTreeWidgetItem *item = *it ;
std::string Id = item->text(RSID_COL_KEYID).toStdString();
rsReputations->setOwnOpinion(RsGxsId(Id),RsReputations::OPINION_NEUTRAL) ;
}
requestIdDetails();
requestIdList();
}
void IdDialog::positivePerson()
{
QList<QTreeWidgetItem *> selected_items = ui->idTreeWidget->selectedItems();
for(QList<QTreeWidgetItem*>::const_iterator it(selected_items.begin());it!=selected_items.end();++it)
{
QTreeWidgetItem *item = *it ;
std::string Id = item->text(RSID_COL_KEYID).toStdString();
rsReputations->setOwnOpinion(RsGxsId(Id),RsReputations::OPINION_POSITIVE) ;
}
requestIdDetails();
requestIdList();
@ -1443,30 +1507,28 @@ void IdDialog::unbanPerson()
void IdDialog::addtoContacts()
{
QTreeWidgetItem *item = ui->idTreeWidget->currentItem();
if (!item)
{
return;
}
QList<QTreeWidgetItem *> selected_items = ui->idTreeWidget->selectedItems();
for(QList<QTreeWidgetItem*>::const_iterator it(selected_items.begin());it!=selected_items.end();++it)
{
QTreeWidgetItem *item = *it ;
std::string Id = item->text(RSID_COL_KEYID).toStdString();
rsIdentity->setAsRegularContact(RsGxsId(Id),true);
}
requestIdList();
}
void IdDialog::removefromContacts()
{
QTreeWidgetItem *item = ui->idTreeWidget->currentItem();
if (!item)
{
return;
}
QList<QTreeWidgetItem *> selected_items = ui->idTreeWidget->selectedItems();
for(QList<QTreeWidgetItem*>::const_iterator it(selected_items.begin());it!=selected_items.end();++it)
{
QTreeWidgetItem *item = *it ;
std::string Id = item->text(RSID_COL_KEYID).toStdString();
rsIdentity->setAsRegularContact(RsGxsId(Id),false);
}
requestIdList();
}

View file

@ -85,8 +85,9 @@ private slots:
void addtoContacts();
void removefromContacts();
void banPerson();
void unbanPerson();
void negativePerson();
void positivePerson();
void neutralPerson();
static QString inviteMessage();
void sendInvite();

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1484</width>
<height>791</height>
<width>747</width>
<height>657</height>
</rect>
</property>
<property name="sizePolicy">
@ -19,8 +19,14 @@
<property name="windowTitle">
<string/>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<layout class="QGridLayout" name="gridLayout_5">
<property name="horizontalSpacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="titleBarFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
@ -35,6 +41,9 @@
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<number>2</number>
</property>
<item>
<widget class="QLabel" name="titleBarPixmap">
<property name="minimumSize">
@ -107,7 +116,7 @@
</layout>
</widget>
</item>
<item>
<item row="0" column="0">
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -500,22 +509,9 @@
&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;
&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;Your own opinion about an identity rules the visibility of that identity for yourself,&lt;/p&gt;
&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;and is shared among friends. A final score is calculated according to a formula that accounts your own opinion and your friends' opinions about someone:&lt;/p&gt;
&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;Your own opinion about an identity rules the visibility of that identity for yourself and your friend nodes. Your own opinion is shared among friends and used to compute a reputation score: If your opinion about an identity is neutral, the reputation score is the average of your friend's opinions. If not, your own opinion gives the score.&lt;/p&gt;
&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; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; S = own_opinion * a + friends_opinion * (1-a)&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; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;The factor 'a' depends on the type of ID. &lt;/p&gt;
&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;- anonymous IDs: &lt;/p&gt;
&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;- PGP-signed IDs by unknown PGP keys: a=&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; 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:&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; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;S &amp;lt; -0.5: Posts are not stored, nor forwarded &lt;/p&gt;
&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;S &amp;lt; 0.2: Posts are hidden, but still transmitted&lt;/p&gt;
&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;S &amp;lt; 0.0: &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; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;The overall rating is computed in such a way that it is not possible for a single person to deterministically change someone's status at neighbor nodes.&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">

View file

@ -1,3 +1,5 @@
#include <QToolButton>
#include <retroshare-gui/mainpage.h>
#include "common/FloatingHelpBrowser.h"
@ -9,12 +11,13 @@ MainPage::MainPage(QWidget *parent , Qt::WindowFlags flags ) : QWidget(parent, f
mHelp = "";
}
void MainPage::registerHelpButton(QAbstractButton *button,const QString& help_html_txt)
void MainPage::registerHelpButton(QToolButton *button,const QString& help_html_txt)
{
if (mHelpBrowser == NULL)
{
mHelpBrowser = new FloatingHelpBrowser(this, button) ;
}
float S = QFontMetricsF(button->font()).height() ;
button->setIconSize(QSize(S,S)) ;
mHelpBrowser->setHelpText(help_html_txt) ;
}

View file

@ -40,7 +40,7 @@
#include "ui_MainWindow.h"
#include "MessengerWindow.h"
#include "NetworkDialog.h"
#include "SearchDialog.h"
#include "gui/FileTransfer/SearchDialog.h"
#include "gui/FileTransfer/TransfersDialog.h"
#include "MessagesDialog.h"
#include "SharedFilesDialog.h"

View file

@ -43,7 +43,7 @@ NetworkView::NetworkView(QWidget *parent)
mScene = new QGraphicsScene();
mScene->setItemIndexMethod(QGraphicsScene::NoIndex);
mScene->setSceneRect(-200, -200, 1200, 1200);
mScene->setSceneRect(0, 0, ui.graphicsView->width(), ui.graphicsView->height());
ui.graphicsView->setScene(mScene);
ui.graphicsView->setEdgeLength(ui.edgeLengthSB->value()) ;

View file

@ -91,8 +91,8 @@
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/icons/information_128.png</normaloff>:/icons/information_128.png</iconset>
<iconset resource="images.qrc">
<normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset>
</property>
<property name="iconSize">
<size>

View file

@ -38,7 +38,7 @@
#include "MainWindow.h"
#include "gui/gxsforums/GxsForumsDialog.h"
#include "gui/gxschannels/GxsChannelDialog.h"
#include "SearchDialog.h"
#include "gui/FileTransfer/SearchDialog.h"
#include "msgs/MessageComposer.h"
#include "util/misc.h"
#include "common/PeerDefs.h"

View file

@ -20,6 +20,8 @@
****************************************************************/
#include <QApplication>
#include <QFile>
#include <QProcess>
#include <QSound>
#include <QDir>
@ -28,6 +30,10 @@
#include <QAudioDeviceInfo>
#endif
// #ifdef QMEDIAPLAYER
// #nclude <QMediaPlayer>
// #endif
#include "SoundManager.h"
#include "settings/rsharesettings.h"
#include "retroshare/rsinit.h"
@ -79,6 +85,7 @@ void SoundManager::soundEvents(SoundEvents &events)
events.addEvent(tr("Chatmessage"), tr("New Msg"), SOUND_NEW_CHAT_MESSAGE, QFileInfo(baseDir, "incomingchat.wav").absoluteFilePath());
events.addEvent(tr("Message"), tr("Message arrived"), SOUND_MESSAGE_ARRIVED, QFileInfo(baseDir, "receive.wav").absoluteFilePath());
events.addEvent(tr("Download"), tr("Download complete"), SOUND_DOWNLOAD_COMPLETE, QFileInfo(baseDir, "ft_complete.wav").absoluteFilePath());
events.addEvent(tr("Lobby"), tr("Message arrived"), SOUND_NEW_LOBBY_MESSAGE, QFileInfo(baseDir, "incomingchat.wav").absoluteFilePath());
/* add plugin events */
int pluginCount = rsPlugins->nbPlugins();
@ -234,12 +241,60 @@ void SoundManager::playFile(const QString &filename)
}
QString playFilename = realFilename(filename);
bool played = false ;
#if QT_VERSION >= QT_VERSION_CHECK (5, 0, 0)
if (!QAudioDeviceInfo::availableDevices(QAudio::AudioOutput).isEmpty()) {
if (!QAudioDeviceInfo::availableDevices(QAudio::AudioOutput).isEmpty())
#else
if (QSound::isAvailable()) {
if (QSound::isAvailable())
#endif
QSound::play(playFilename);
}
{
QSound::play(playFilename);
played = true ;
}
if(!played) // let's go for the hard core stuff
{
// #ifdef QMEDIAPLAYER
// static QMediaPlayer *qmplayer;
// if (qmplayer == NULL) {
// qmplayer = new QMediaPlayer();
// qmplayer->setMedia(QMediaContent(QUrl::fromLocalFile(playFilename)));
// }
// std::cerr << "Play QMediaPlayer" << std::endl;
// qmplayer->play();
// return;
// #endif
#ifdef Q_OS_LINUX
QString player_cmd = soundDetectPlayer();
QStringList args = player_cmd.split(' ');
args += filename;
QString prog = args.takeFirst();
//std::cerr << "Play " << prog.toStdString() << std::endl;
QProcess::startDetached(prog, args);
#endif
}
}
#ifdef Q_OS_LINUX
/** Detect default player helper on unix like systems
* Inspired by Psi IM (0.15) in common.cpp
*/
QString SoundManager::soundDetectPlayer()
{
// prefer ALSA on linux
if (QFile("/proc/asound").exists()) {
return "aplay -q";
}
// fallback to "play"
return "play";
}
#endif

View file

@ -29,6 +29,7 @@
#define SOUND_USER_ONLINE "User_go_Online"
#define SOUND_MESSAGE_ARRIVED "MessageArrived"
#define SOUND_DOWNLOAD_COMPLETE "DownloadComplete"
#define SOUND_NEW_LOBBY_MESSAGE "NewLobbyMessage"
class SoundEvents
{
@ -67,6 +68,10 @@ signals:
public:
static void create();
#ifdef Q_OS_LINUX
static QString soundDetectPlayer();
#endif
static void initDefault();
static QString defaultFilename(const QString &event, bool check);
static QString convertFilename(const QString &filename);
@ -84,7 +89,7 @@ public:
static QString eventFilename(const QString &event);
static void setEventFilename(const QString &event, const QString &filename);
private:
SoundManager();
};

View file

@ -18,6 +18,11 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* ccr . 2016 Jan 26
*
* Play sound on incoming messages.
*
****************************************************************/
#include <unistd.h>
@ -42,6 +47,7 @@
#include "gui/gxs/GxsIdChooser.h"
#include "gui/gxs/GxsIdDetails.h"
#include "util/HandleRichText.h"
#include "gui/SoundManager.h"
#include <retroshare/rsnotify.h>
@ -400,7 +406,8 @@ void ChatLobbyDialog::addChatMsg(const ChatMessage& msg)
name = QString::fromUtf8(msg.peer_alternate_nickname.c_str()) + " (" + QString::fromStdString(gxs_id.toStdString()) + ")" ;
ui.chatWidget->addChatMsg(msg.incoming, name, gxs_id, sendTime, recvTime, message, ChatWidget::MSGTYPE_NORMAL);
emit messageReceived(msg.incoming, id(), sendTime, name, message) ;
emit messageReceived(msg.incoming, id(), sendTime, name, message) ;
SoundManager::play(SOUND_NEW_LOBBY_MESSAGE);
// This is a trick to translate HTML into text.
QTextEdit editor;

View file

@ -127,6 +127,7 @@ ChatWidget::ChatWidget(QWidget *parent) :
connect(ui->actionChooseColor, SIGNAL(triggered()), this, SLOT(chooseColor()));
connect(ui->actionResetFont, SIGNAL(triggered()), this, SLOT(resetFont()));
connect(ui->actionQuote, SIGNAL(triggered()), this, SLOT(quote()));
connect(ui->actionDropPlacemark, SIGNAL(triggered()), this, SLOT(dropPlacemark()));
connect(ui->actionSave_image, SIGNAL(triggered()), this, SLOT(saveImage()));
connect(ui->hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));
@ -923,7 +924,7 @@ void ChatWidget::addChatMsg(bool incoming, const QString &name, const RsGxsId gx
QString strGxsId = "";
if (!gxsId.isNull())
strGxsId = QString::fromStdString(gxsId.toStdString());
formatMsg.replace(QString("<a name=\"name\">"),QString("<a name=\"%1\">").arg(strGxsId));
formatMsg.replace(QString("<a name=\"name\">"),QString("<a name=\"Person Id: %1\">").arg(strGxsId));
QTextCursor textCursor = QTextCursor(ui->textBrowser->textCursor());
textCursor.movePosition(QTextCursor::End);
@ -979,6 +980,7 @@ void ChatWidget::contextMenuTextBrowser(QPoint point)
contextMnu->addSeparator();
contextMnu->addAction(ui->actionClearChatHistory);
contextMnu->addAction(ui->actionQuote);
contextMnu->addAction(ui->actionDropPlacemark);
QTextCursor cursor = ui->textBrowser->cursorForPosition(point);
if(ImageUtil::checkImage(cursor))
@ -1657,7 +1659,7 @@ void ChatWidget::updatePeersCustomStateString(const QString& /*peer_id*/, const
void ChatWidget::updateStatusString(const QString &statusMask, const QString &statusString, bool permanent)
{
ui->typingLabel->setText(QString(statusMask).arg(tr(statusString.toLatin1()))); // displays info for 5 secs.
ui->typingLabel->setText(QString(statusMask).arg(tr(statusString.toUtf8()))); // displays info for 5 secs.
ui->typingpixmapLabel->setPixmap(QPixmap(":images/typing.png") );
if (statusString == "is typing...") {
@ -1693,10 +1695,16 @@ void ChatWidget::quote()
{
QStringList sl = text.split(QRegExp("[\r\n]"),QString::SkipEmptyParts);
text = sl.join("\n>");
text.replace(QChar(-4),"");//Char used when image on text.
emit ui->chatTextEdit->append(QString(">") + text);
}
}
void ChatWidget::dropPlacemark()
{
ui->textBrowser->append("----------");
}
void ChatWidget::saveImage()
{
QPoint point = ui->actionSave_image->data().toPoint();

View file

@ -186,6 +186,7 @@ private slots:
bool fileSaveAs();
void quote();
void dropPlacemark();
void saveImage();
private:

View file

@ -1052,6 +1052,14 @@ border-image: url(:/images/closepressed.png)
<string>Quotes the selected text</string>
</property>
</action>
<action name="actionDropPlacemark">
<property name="text">
<string>Drop Placemark</string>
</property>
<property name="toolTip">
<string>Insert horizontal rule</string>
</property>
</action>
<action name="actionSave_image">
<property name="icon">
<iconset resource="../images.qrc">

View file

@ -254,10 +254,10 @@ void FriendSelectionWidget::loadRequest(const TokenQueue */*queue*/, const Token
for(uint32_t i=0;i<datavector.size();++i)
{
gxsIds.push_back(datavector[i].mMeta.mGroupId) ;
std::cerr << " got ID = " << datavector[i].mMeta.mGroupId << std::endl;
//std::cerr << " got ID = " << datavector[i].mMeta.mGroupId << std::endl;
}
std::cerr << "Got all " << datavector.size() << " ids from rsIdentity. Calling update of list." << std::endl;
//std::cerr << "Got all " << datavector.size() << " ids from rsIdentity. Calling update of list." << std::endl;
fillList() ;
}

View file

@ -269,7 +269,7 @@ void MimeTextEdit::pasteOwnCertificateLink()
void MimeTextEdit::pastePlainText()
{
insertPlainText(QApplication::clipboard()->text());
insertPlainText(QApplication::clipboard()->text().remove(QChar(-4)));//Char used when image on text.
}
void MimeTextEdit::spoiler()

View file

@ -127,7 +127,8 @@ GraphWidget::GraphWidget(QWidget *)
// scene->setItemIndexMethod(QGraphicsScene::NoIndex);
// scene->clear() ;
// setScene(scene);
// scene->setSceneRect(0, 0, 500, 500);
// scene()->setSceneRect(0, 0, width(), height());
setCacheMode(CacheBackground);
setViewportUpdateMode(BoundingRectViewportUpdate);
@ -154,7 +155,8 @@ void GraphWidget::clearGraph()
// }
scene()->clear();
scene()->setSceneRect(-200, -200, 1000, 1000);
scene()->setSceneRect(0, 0, width(), height());
_edges.clear();
_nodes.clear();
_friction_factor = 1.0f ;
@ -391,9 +393,11 @@ void GraphWidget::setEdgeLength(uint32_t l)
void GraphWidget::setNameSearch(QString s)
{
float f = QFontMetrics(font()).height()/16.0 ;
if (s.length() == 0){
for(uint32_t i=0;i<_nodes.size();++i)
_nodes[i]->setNodeDrawSize(20);
_nodes[i]->setNodeDrawSize(12 * f);
forceRedraw();
return;
}
@ -405,10 +409,10 @@ void GraphWidget::setNameSearch(QString s)
if (ns.find(qs) != std::string::npos) {
//std::cout << "found!" << '\n';
ni->setNodeDrawSize(22);
ni->setNodeDrawSize(22 * f);
//std::cout << ni->getNodeDrawSize() << '\n';
} else {
ni->setNodeDrawSize(12);
ni->setNodeDrawSize(12 * f);
}
}
@ -420,47 +424,53 @@ void GraphWidget::forceRedraw()
for(uint32_t i=0;i<_nodes.size();++i)
_nodes[i]->update(_nodes[i]->boundingRect()) ;
}
void GraphWidget::resizeEvent(QResizeEvent *event)
{
scene()->setSceneRect(QRectF(QPointF(0,0),event->size()));
}
void GraphWidget::wheelEvent(QWheelEvent *event)
{
scaleView(pow((double)2, -event->delta() / 240.0));
}
void GraphWidget::drawBackground(QPainter *painter, const QRectF &rect)
{
Q_UNUSED(rect);
// Shadow
QRectF sceneRect = this->sceneRect();
QRectF rightShadow(sceneRect.right(), sceneRect.top() + 5, 5, sceneRect.height());
QRectF bottomShadow(sceneRect.left() + 5, sceneRect.bottom(), sceneRect.width(), 5);
if (rightShadow.intersects(rect) || rightShadow.contains(rect))
painter->fillRect(rightShadow, Qt::darkGray);
if (bottomShadow.intersects(rect) || bottomShadow.contains(rect))
painter->fillRect(bottomShadow, Qt::darkGray);
// Fill
QLinearGradient gradient(sceneRect.topLeft(), sceneRect.bottomRight());
gradient.setColorAt(0, Qt::white);
gradient.setColorAt(1, Qt::lightGray);
painter->fillRect(rect.intersected(sceneRect), gradient);
painter->setBrush(Qt::NoBrush);
painter->drawRect(sceneRect);
// Text
QRectF textRect(sceneRect.left() + 4, sceneRect.top() + 4,
sceneRect.width() - 4, sceneRect.height() - 4);
QString message(tr("Click and drag the nodes around, and zoom with the mouse "
"wheel or the '+' and '-' keys"));
QFont font = painter->font();
font.setBold(true);
font.setPointSize(14);
painter->setFont(font);
painter->setPen(Qt::lightGray);
painter->drawText(textRect.translated(2, 2), message);
painter->setPen(Qt::black);
painter->drawText(textRect, message);
}
//void GraphWidget::drawBackground(QPainter *painter, const QRectF &rect)
//{
// Q_UNUSED(rect);
//
// // Shadow
// QRectF sceneRect = this->sceneRect();
// QRectF rightShadow(sceneRect.right(), sceneRect.top() + 5, 5, sceneRect.height());
// QRectF bottomShadow(sceneRect.left() + 5, sceneRect.bottom(), sceneRect.width(), 5);
// if (rightShadow.intersects(rect) || rightShadow.contains(rect))
// painter->fillRect(rightShadow, Qt::darkGray);
// if (bottomShadow.intersects(rect) || bottomShadow.contains(rect))
// painter->fillRect(bottomShadow, Qt::darkGray);
//
// // Fill
// QLinearGradient gradient(sceneRect.topLeft(), sceneRect.bottomRight());
// gradient.setColorAt(0, Qt::white);
// gradient.setColorAt(1, Qt::lightGray);
// painter->fillRect(rect.intersected(sceneRect), gradient);
// painter->setBrush(Qt::NoBrush);
// painter->drawRect(sceneRect);
//
// // Text
// QRectF textRect(sceneRect.left() + 4, sceneRect.top() + 4,
// sceneRect.width() - 4, sceneRect.height() - 4);
// QString message(tr("Click and drag the nodes around, and zoom with the mouse "
// "wheel or the '+' and '-' keys"));
//
// QFont font = painter->font();
// font.setBold(true);
// font.setPointSize(14);
// painter->setFont(font);
// painter->setPen(Qt::lightGray);
// painter->drawText(textRect.translated(2, 2), message);
// painter->setPen(Qt::black);
// painter->drawText(textRect, message);
//}
void GraphWidget::scaleView(qreal scaleFactor)
{

View file

@ -91,10 +91,11 @@ public:
void forceRedraw() ;
protected:
void keyPressEvent(QKeyEvent *event);
void timerEvent(QTimerEvent *event);
void wheelEvent(QWheelEvent *event);
void drawBackground(QPainter *painter, const QRectF &rect);
virtual void keyPressEvent(QKeyEvent *event);
virtual void timerEvent(QTimerEvent *event);
virtual void wheelEvent(QWheelEvent *event);
virtual void resizeEvent(QResizeEvent *event);
//void drawBackground(QPainter *painter, const QRectF &rect);
void scaleView(qreal scaleFactor);

View file

@ -205,8 +205,8 @@ void Node::calculateForces(const double *map,int width,int height,int W,int H,fl
QRectF sceneRect = scene()->sceneRect();
newPos = pos() + QPointF(_speedx, _speedy) / friction_factor;
newPos.setX(qMin(qMax(newPos.x(), sceneRect.left() + 10), sceneRect.right() - 10));
newPos.setY(qMin(qMax(newPos.y(), sceneRect.top() + 10), sceneRect.bottom() - 10));
newPos.setX(qMin(qMax(newPos.x(), sceneRect.left()), sceneRect.right()));
newPos.setY(qMin(qMax(newPos.y(), sceneRect.top()) , sceneRect.bottom()));
}
bool Node::advance()
@ -222,20 +222,22 @@ bool Node::advance()
QRectF Node::boundingRect() const
{
qreal adjust = 2;
float m = QFontMetricsF(graph->font()).height();
float f = m/16.0;
qreal adjust = 2*f;
/* add in the size of the text */
qreal realwidth = 40;
qreal realwidth = 40*f;
if (mDeterminedBB)
{
realwidth = mBBWidth + adjust;
}
if (realwidth < 23 + adjust)
if (realwidth < 23*f + adjust)
{
realwidth = 23 + adjust;
realwidth = 23*f + adjust;
}
return QRectF(-10 - adjust, -10 - adjust,
realwidth, 23 + adjust);
return QRectF(-10*f - adjust, -10*f - adjust, realwidth, 23*f + adjust);
}
QPainterPath Node::shape() const
@ -314,12 +316,17 @@ void Node::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
painter->setBrush(gradient);
painter->setPen(QPen(Qt::black, 0));
painter->drawEllipse(-mNodeDrawSize2, -mNodeDrawSize2, mNodeDrawSize, mNodeDrawSize);
painter->drawText(-10, 0, QString::fromUtf8(_desc_string.c_str()));
QString txt = QString::fromUtf8(_desc_string.c_str());
float m = QFontMetricsF(graph->font()).height();
float f = m/16.0;
painter->drawText(-10, 5*f, txt) ;
if (!mDeterminedBB)
{
QRect textBox = painter->boundingRect(-10, 0, 400, 20, 0, QString::fromUtf8(_desc_string.c_str()));
mBBWidth = textBox.width();
QRect textBox = painter->boundingRect(-10, 5*f, QFontMetricsF(graph->font()).width(txt), 1.5*m, Qt::AlignVCenter, QString::fromUtf8(_desc_string.c_str()));
mBBWidth = textBox.width()+40*f;
mDeterminedBB = true;
}
}

View file

@ -160,11 +160,11 @@ static void loadPrivateIdsCallback(GxsIdDetailsType type, const RsIdentityDetail
chooser->setItemData(index, (type == GXS_ID_DETAILS_TYPE_DONE) ? TYPE_FOUND_ID : TYPE_UNKNOWN_ID, ROLE_TYPE);
chooser->setItemIcon(index, icons.empty() ? QIcon() : icons[0]);
std::cerr << "ID=" << details.mId << ", chooser->flags()=" << chooser->flags() << ", flags=" << details.mFlags ;
//std::cerr << "ID=" << details.mId << ", chooser->flags()=" << chooser->flags() << ", flags=" << details.mFlags ;
if((chooser->flags() & IDCHOOSER_NON_ANONYMOUS) && !(details.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED))
{
std::cerr << " - disabling ID - entry = " << index << std::endl;
//std::cerr << " - disabling ID - entry = " << index << std::endl;
chooser->setEntryEnabled(index,false) ;
}
std::cerr << std::endl;

View file

@ -3,6 +3,9 @@
<file>icons/add_user_256.png</file>
<file>icons/anonymous_blue_128.png</file>
<file>icons/anonymous_green_128.png</file>
<file>icons/aol.png</file>
<file>icons/avatar_128.png</file>
<file>icons/avatar_grey_128.png</file>
<file>icons/blank_blue_128.png</file>
<file>icons/blank_green_128.png</file>
<file>icons/browsable_blue_128.png</file>
@ -19,6 +22,7 @@
<file>icons/friends_128.png</file>
<file>icons/global_switch_off_128.png</file>
<file>icons/global_switch_on_128.png</file>
<file>icons/gmail.png</file>
<file>icons/help_128.png</file>
<file>icons/help_64.png</file>
<file>icons/information_128.png</file>
@ -38,6 +42,7 @@
<file>icons/mail_old_128.png</file>
<file>icons/mail_red_128.png</file>
<file>icons/newsfeed128.png</file>
<file>icons/outlook.png</file>
<file>icons/plugins_128.png</file>
<file>icons/posted_128.png</file>
<file>icons/posted_red_128.png</file>
@ -55,19 +60,18 @@
<file>icons/tile_downloaded_48.png</file>
<file>icons/tile_downloading_48.png</file>
<file>icons/tile_inactive_48.png</file>
<file>icons/tor-logo.png</file>
<file>icons/tor-off.png</file>
<file>icons/tor-on.png</file>
<file>icons/tor-starting.png</file>
<file>icons/tor-stopping.png</file>
<file>icons/user-away_64.png</file>
<file>icons/user-away-extended_64.png</file>
<file>icons/user-busy_64.png</file>
<file>icons/user-offline_64.png</file>
<file>icons/user-online_64.png</file>
<file>icons/yellow_biohazard64.png</file>
<file>icons/gmail.png</file>
<file>icons/yahoo.png</file>
<file>icons/outlook.png</file>
<file>icons/aol.png</file>
<file>icons/yandex.png</file>
<file>icons/tor-on.png</file>
<file>icons/tor-logo.png</file>
<file>icons/tor-off.png</file>
<file>icons/yellow_biohazard64.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

View file

@ -20,6 +20,26 @@
* Boston, MA 02110-1301, USA.
****************************************************************/
/* ccr . 2015 Aug 01 . Resize Main page and Main window.
*
* On very small legacy CRTs of about 15" (38 cm) RetroShare pages are
* initially too deep (too tall) to fit the screen at 1024x768
* resolution. Some can be shrunk down manually from their initial
* size. Others cannot. This patch tries to allow each page to be
* shrunk somewhat. Then code that runs elsewhere to fit the logical
* Main window into the physical screen will have a better chance of
* success. Notably, on Linux -- Gnome3 -- X11 systems, only when the
* Main window first fits entirely into the physical screen, can it
* then be maximized.
*
* This code is borrowed from a Stack Overflow post:
*
* o Darkgaze. "Resize QStackedWidget to the Page Which Is Opened." 23
* Jan. 2013. Online posting. Stack Overflow. 1 Aug. 2015
* <https://stackoverflow.com/questions/14480696/resize-qstackedwidget-to-the-page-which-is-opened>.
*
*/
#include <QAction>
#include "mainpagestack.h"
@ -34,6 +54,7 @@ void
MainPageStack::add(MainPage *page, QAction *action)
{
_pages.insert(action, page);
page->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); /* 2015 Aug 01 */
insertWidget(count(), page);
}
@ -61,3 +82,14 @@ MainPageStack::showPage(QAction *pageAction)
setCurrentWidget(_pages.value(pageAction));
}
/** Adjusts the size of the Main page and the Main window. */
void
MainPageStack::onCurrentChanged(int index) /* 2015 Aug 01 */
{
QWidget* pWidget = widget(index);
Q_ASSERT(pWidget);
pWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
pWidget->adjustSize();
adjustSize();
}

View file

@ -50,6 +50,8 @@ public:
public slots:
/** Displays the page associated with the activated action. */
void showPage(QAction *pageAction);
/** Adjusts the size of the Main page and the Main window. */
void onCurrentChanged(int index);
private:
/** Maps an action to a Main page. */

View file

@ -420,6 +420,10 @@ void MessageComposer::processSettings(bool bLoad)
int index = Settings->value("ShowType", 0).toInt();
ui.filterComboBox->setCurrentIndex(index);
RsGxsId resp_to_id ( Settings->value("LastRespondTo").toString().toStdString());
if(!resp_to_id.isNull())
ui.respond_to_CB->setDefaultId(resp_to_id);
} else {
// save settings
@ -433,6 +437,7 @@ void MessageComposer::processSettings(bool bLoad)
// state of filter combobox
Settings->setValue("ShowType", ui.filterComboBox->currentIndex());
Settings->setValue("LastRespondTo",ui.respond_to_CB->itemData(ui.respond_to_CB->currentIndex()).toString());
}
Settings->endGroup();
@ -1280,7 +1285,7 @@ bool MessageComposer::sendMessage_internal(bool bDraftbox)
mi.rsgxsid_srcId = RsGxsId(ui.respond_to_CB->itemData(ui.respond_to_CB->currentIndex()).toString().toStdString()) ;
std::cerr << "MessageSend: setting 'from' field to GXS id = " << mi.rsgxsid_srcId << std::endl;
//std::cerr << "MessageSend: setting 'from' field to GXS id = " << mi.rsgxsid_srcId << std::endl;
mi.title = misc::removeNewLine(ui.titleEdit->text()).toUtf8().constData();
// needed to send system flags with reply

View file

@ -661,3 +661,4 @@ IdEditDialog QLabel#info_label
background: #FFFFD7;
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFD7, stop:1 #FFFFB2);
}

View file

@ -17,6 +17,41 @@
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Distant messages:</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="2">
<widget class="QComboBox" name="comboBox">
<item>
<property name="text">
<string>Everyone</string>
</property>
</item>
<item>
<property name="text">
<string>Contacts</string>
</property>
</item>
<item>
<property name="text">
<string>Nobody</string>
</property>
</item>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Accept encrypted distant messages from</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
@ -54,41 +89,6 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Distant messages:</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="2">
<widget class="QComboBox" name="comboBox">
<item>
<property name="text">
<string>Everyone</string>
</property>
</item>
<item>
<property name="text">
<string>Contacts</string>
</property>
</item>
<item>
<property name="text">
<string>Nobody</string>
</property>
</item>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Accept encrypted distant messages from</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">

View file

@ -27,9 +27,6 @@
<string>Plugins</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="margin">
<number>6</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="frameShape">
@ -43,7 +40,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>391</width>
<width>920</width>
<height>16</height>
</rect>
</property>
@ -74,20 +71,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTextBrowser" name="_lookupDirectories_TB">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>50</height>
</size>
</property>
</widget>
<widget class="QTextBrowser" name="_lookupDirectories_TB"/>
</item>
</layout>
</widget>

View file

@ -798,6 +798,9 @@ behind a firewall or a VPN.</string>
</item>
<item>
<widget class="QSpinBox" name="hiddenpage_proxyPort_tor">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This is the port of the Tor Socks proxy. Your Retroshare node can use this port to connect to&lt;/p&gt;&lt;p&gt;Hidden nodes. The led at right turns green when this port is active on your computer. &lt;/p&gt;&lt;p&gt;This does not mean however that your Retroshare traffic transits though Tor. It does only if &lt;/p&gt;&lt;p&gt;you connect to Hidden nodes, or if you are running a Hidden node yourself.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="minimum">
<number>10</number>
</property>
@ -828,6 +831,9 @@ behind a firewall or a VPN.</string>
</item>
<item>
<widget class="QLabel" name="label_9">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This led is green when the port listen on the left is active on your computer. It does not&lt;/p&gt;&lt;p&gt;mean that your Retroshare traffic transits though Tor. It will do so only if &lt;/p&gt;&lt;p&gt;you connect to Hidden nodes, or if you are running a Hidden node yourself.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Tor outgoing Okay</string>
</property>
@ -859,6 +865,9 @@ behind a firewall or a VPN.</string>
</item>
<item>
<widget class="QSpinBox" name="hiddenpage_proxyPort_i2p">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This is the port of the I2P Socks proxy. Your Retroshare node can use this port to connect to&lt;/p&gt;&lt;p&gt;Hidden nodes. The led at right turns green when this port is active on your computer. &lt;/p&gt;&lt;p&gt;This does not mean however that your Retroshare traffic transits though I2P. It does only if &lt;/p&gt;&lt;p&gt;you connect to Hidden nodes, or if you are running a Hidden node yourself.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="minimum">
<number>10</number>
</property>
@ -883,6 +892,9 @@ behind a firewall or a VPN.</string>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This led is green when the port listen on the left is active on your computer. It does not&lt;/p&gt;&lt;p&gt;mean that your Retroshare traffic transits though I2P. It will do so only if &lt;/p&gt;&lt;p&gt;you connect to Hidden nodes, or if you are running a Hidden node yourself.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>I2P outgoing Okay</string>
</property>
@ -949,7 +961,7 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
<item>
<widget class="QPushButton" name="testIncoming_PB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This button simulates a SSL connection to your hidden address using the corresponding proxy. If your hidden node is reachable, it should cause a SSL handshake error, which RS will interpret as a valid connection state. This operation might also cause several &amp;quot;security warning&amp;quot; about connections from your local host IP (127.0.0.1) in the News Feed if you enabled it,&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This button simulates a SSL connection to your hidden address using the corresponding proxy. If your hidden node is reachable, it should cause a SSL handshake error, which RS will interpret as a valid connection state. This operation might also cause several &amp;quot;security warning&amp;quot; about connections from your local host IP (127.0.0.1) in the News Feed if you enabled it, which you should interpret as a sign of good communication.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Test</string>
@ -1016,6 +1028,9 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
</item>
<item>
<widget class="QLabel" name="l_incomingTestResult">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This led turns green only if you launch an active test using the above button. &lt;/p&gt;&lt;p&gt;When it does, it means that your hidden node can be reached from anywhere, using the Tor (resp. I2P) &lt;/p&gt;&lt;p&gt;network. Congratulations!&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>incoming ok</string>
</property>

View file

@ -23,16 +23,7 @@
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>0</number>
</property>
<item>
@ -106,29 +97,17 @@
</item>
<item row="0" column="0" rowspan="3">
<widget class="QListWidget" name="listWidget">
<property name="minimumSize">
<size>
<width>130</width>
<height>0</height>
</size>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>130</width>
<height>16777215</height>
</size>
</property>
<property name="alternatingRowColors">
<bool>false</bool>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
<property name="defaultDropAction">
<enum>Qt::IgnoreAction</enum>
</property>
<property name="textElideMode">
<enum>Qt::ElideMiddle</enum>
<enum>Qt::ElideRight</enum>
</property>
<property name="movement">
<enum>QListView::Static</enum>
@ -148,12 +127,6 @@
<property name="spacing">
<number>0</number>
</property>
<property name="gridSize">
<size>
<width>100</width>
<height>26</height>
</size>
</property>
<property name="viewMode">
<enum>QListView::ListMode</enum>
</property>
@ -191,21 +164,12 @@
<rect>
<x>0</x>
<y>0</y>
<width>666</width>
<height>517</height>
<width>540</width>
<height>495</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>3</number>
</property>
<item>

View file

@ -25,7 +25,6 @@ public:
virtual void getValues(std::map<std::string,float>& values) const;
virtual QString displayValue(float v) const;
// virtual QString displayName(int i) const;
virtual QString legend(int i,float v) const;
virtual void update();
QString unitName() const ;

View file

@ -22,6 +22,8 @@ BandwidthStatsWidget::BandwidthStatsWidget(QWidget *parent)
ui.unit_CB->addItem(tr("KB/s")) ;
ui.unit_CB->addItem(tr("Count")) ;
ui.logScale_CB->setChecked(true) ;
ui.bwgraph_BW->source()->setSelector(BWGraphSource::SELECTOR_TYPE_FRIEND,BWGraphSource::GRAPH_TYPE_SUM) ;
ui.bwgraph_BW->source()->setSelector(BWGraphSource::SELECTOR_TYPE_SERVICE,BWGraphSource::GRAPH_TYPE_SUM) ;
@ -33,6 +35,7 @@ BandwidthStatsWidget::BandwidthStatsWidget(QWidget *parent)
QObject::connect(ui.updn_CB ,SIGNAL(currentIndexChanged(int)),this, SLOT( updateUpDownSelection(int))) ;
QObject::connect(ui.unit_CB ,SIGNAL(currentIndexChanged(int)),this, SLOT( updateUnitSelection(int))) ;
QObject::connect(ui.service_CB,SIGNAL(currentIndexChanged(int)),this, SLOT(updateServiceSelection(int))) ;
QObject::connect(ui.logScale_CB,SIGNAL(toggled(bool)),this, SLOT(toggleLogScale(bool))) ;
// setup one timer for auto-update
@ -42,6 +45,13 @@ BandwidthStatsWidget::BandwidthStatsWidget(QWidget *parent)
mTimer->start(2000) ;
}
void BandwidthStatsWidget::toggleLogScale(bool b)
{
if(b)
ui.bwgraph_BW->setFlags(RSGraphWidget::RSGRAPH_FLAGS_LOG_SCALE_Y) ;
else
ui.bwgraph_BW->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_LOG_SCALE_Y) ;
}
void BandwidthStatsWidget::updateComboBoxes()
{
if(!isVisible())

View file

@ -14,7 +14,8 @@ protected slots:
void updateComboBoxes() ;
void updateUpDownSelection(int n);
void updateUnitSelection(int n);
void toggleLogScale(bool b);
private:
Ui::BwStatsWidget ui;

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>812</width>
<height>349</height>
<width>1128</width>
<height>385</height>
</rect>
</property>
<property name="windowTitle">
@ -18,14 +18,7 @@
<number>0</number>
</property>
<item>
<widget class="BWGraph" name="bwgraph_BW">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
<widget class="BWGraph" name="bwgraph_BW" native="true"/>
</item>
<item>
<widget class="QGroupBox" name="informationSelector_GB">
@ -110,6 +103,13 @@
<item>
<widget class="QComboBox" name="unit_CB"/>
</item>
<item>
<widget class="QCheckBox" name="logScale_CB">
<property name="text">
<string>Log scale</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
@ -131,8 +131,8 @@
<customwidgets>
<customwidget>
<class>BWGraph</class>
<extends>QFrame</extends>
<header>gui/statistics/BWGraph.h</header>
<extends>QWidget</extends>
<header location="global">gui/statistics/BWGraph.h</header>
<container>1</container>
</customwidget>
</customwidgets>

View file

@ -23,6 +23,7 @@
#include <QTimer>
#include <QObject>
#include <QFontMetrics>
#include <QWheelEvent>
#include <time.h>
#include <QMenu>
@ -42,17 +43,18 @@
#include "util/QtVersion.h"
#include "util/misc.h"
#define COL_ID 0
#define COL_NICKNAME 1
#define COL_DESTINATION 2
#define COL_DATASTATUS 3
#define COL_TUNNELSTATUS 4
#define COL_DATASIZE 5
#define COL_DATAHASH 6
#define COL_RECEIVED 7
#define COL_SEND 8
#define COL_ID 0
#define COL_NICKNAME 1
#define COL_DESTINATION 2
#define COL_DATASTATUS 3
#define COL_TUNNELSTATUS 4
#define COL_DATASIZE 5
#define COL_DATAHASH 6
#define COL_RECEIVED 7
#define COL_SEND 8
#define COL_DUPLICATION_FACTOR 9
static const int PARTIAL_VIEW_SIZE = 9 ;
static const int MAX_TUNNEL_REQUESTS_DISPLAY = 10 ;
static QColor colorScale(float f)
@ -186,6 +188,7 @@ void GlobalRouterStatistics::updateContent()
item -> setData(COL_DATAHASH, Qt::DisplayRole, QString::fromStdString(cache_infos[i].item_hash.toStdString()));
item -> setData(COL_RECEIVED, Qt::DisplayRole, QString::number(now - cache_infos[i].routing_time));
item -> setData(COL_SEND, Qt::DisplayRole, QString::number(now - cache_infos[i].last_sent_time));
item -> setData(COL_DUPLICATION_FACTOR, Qt::DisplayRole, QString::number(cache_infos[i].duplication_factor));
}
}
@ -211,6 +214,7 @@ GlobalRouterStatisticsWidget::GlobalRouterStatisticsWidget(QWidget *parent)
maxWidth = 400*fact ;
maxHeight = 0 ;
mCurrentN = PARTIAL_VIEW_SIZE/2+1 ;
}
void GlobalRouterStatisticsWidget::updateContent()
@ -218,6 +222,8 @@ void GlobalRouterStatisticsWidget::updateContent()
RsGRouter::GRouterRoutingMatrixInfo matrix_info ;
rsGRouter->getRoutingMatrixInfo(matrix_info) ;
mNumberOfKnownKeys = matrix_info.per_friend_probabilities.size() ;
float size = QFontMetricsF(font()).height() ;
float fact = size/14.0 ;
@ -302,44 +308,97 @@ void GlobalRouterStatisticsWidget::updateContent()
oy += celly ;
oy += celly ;
//print friends in the same order their prob is shown
QString FO = tr("Friend Order (");
RsPeerDetails peer_ssl_details;
for(uint32_t i=0;i<matrix_info.friend_ids.size();++i){
rsPeers->getPeerDetails(matrix_info.friend_ids[i], peer_ssl_details);
QString fn = QString::fromUtf8(peer_ssl_details.name.c_str());
FO+=fn;
FO+=" ";
}
FO+=")";
painter.drawText(ox+0*cellx,oy+fm_times.height(),FO) ;
oy += celly ;
oy += celly ;
// //print friends in the same order their prob is shown
// QString FO = tr("Friend Order (");
// RsPeerDetails peer_ssl_details;
// for(uint32_t i=0;i<matrix_info.friend_ids.size();++i){
// rsPeers->getPeerDetails(matrix_info.friend_ids[i], peer_ssl_details);
// QString fn = QString::fromUtf8(peer_ssl_details.name.c_str());
// FO+=fn;
// FO+=" ";
//
// }
// FO+=")";
//
// painter.drawText(ox+0*cellx,oy+fm_times.height(),FO) ;
// oy += celly ;
// oy += celly ;
static const int MaxKeySize = 20*fact ;
painter.setFont(monospace_f) ;
for(std::map<GRouterKeyId,std::vector<float> >::const_iterator it(matrix_info.per_friend_probabilities.begin());it!=matrix_info.per_friend_probabilities.end();++it)
int n=0;
QString ids;
std::vector<float> current_probs ;
int current_oy = 0 ;
mMinWheelZoneX = ox+2*cellx ;
mMinWheelZoneY = oy ;
RsGxsId current_id ;
float current_width=0 ;
for(std::map<GRouterKeyId,std::vector<float> >::const_iterator it(matrix_info.per_friend_probabilities.begin());it!=matrix_info.per_friend_probabilities.end();++it,++n)
if(n >= mCurrentN-PARTIAL_VIEW_SIZE/2 && n <= mCurrentN+PARTIAL_VIEW_SIZE/2)
{
//bool is_null = false ;
//for(uint32_t i=0;i<matrix_info.friend_ids.size();++i)
// if(it->second[i] > 0.0)
// is_null = false ;
//if(!is_null)
//{
ids = QString::fromStdString(it->first.toStdString())+" : " ;
painter.drawText(ox+2*cellx,oy+celly,ids) ;
for(uint32_t i=0;i<matrix_info.friend_ids.size();++i)
painter.fillRect(ox+i*cellx+fm_monospace.width(ids),oy+0.15*celly,cellx,celly,colorScale(it->second[i])) ;
if(n == mCurrentN)
{
current_probs = it->second ;
current_oy = oy ;
current_id = it->first ;
current_width = ox+matrix_info.friend_ids.size()*cellx+fm_monospace.width(ids);
}
oy += celly ;
//}
}
mMaxWheelZoneX = ox+matrix_info.friend_ids.size()*cellx + fm_monospace.width(ids);
RsIdentityDetails iddetails ;
if(rsIdentity->getIdDetails(current_id,iddetails))
painter.drawText(current_width+cellx, current_oy+celly, QString::fromUtf8(iddetails.mNickname.c_str())) ;
else
painter.drawText(current_width+cellx, current_oy+celly, tr("[Unknown identity]")) ;
mMaxWheelZoneY = oy+celly ;
painter.setPen(QColor::fromRgb(0,0,0)) ;
painter.setPen(QColor::fromRgb(0.5,0.5,0.5));
painter.drawRect(ox+2*cellx,current_oy+0.15*celly,fm_monospace.width(ids)+cellx*matrix_info.friend_ids.size()- 2*cellx,celly) ;
float total_length = (matrix_info.friend_ids.size()+2)*cellx ;
if(!current_probs.empty())
for(uint32_t i=0;i<matrix_info.friend_ids.size();++i)
{
bool is_null = true ;
for(uint32_t i=0;i<matrix_info.friend_ids.size();++i)
if(it->second[i] > 0.0)
is_null = false ;
if(!is_null)
{
QString ids = QString::fromStdString(it->first.toStdString())+" : " ;
painter.drawText(ox+2*cellx,oy+celly,ids) ;
for(uint32_t i=0;i<matrix_info.friend_ids.size();++i)
painter.fillRect(ox+i*cellx+fm_monospace.width(ids),oy,cellx,celly,colorScale(it->second[i])) ;
oy += celly ;
}
float x1 = ox+(i+0.5)*cellx+fm_monospace.width(ids) ;
float y1 = oy+0.15*celly ;
float y2 = y1+(matrix_info.friend_ids.size()-1-i+1)*celly;
RsPeerDetails peer_ssl_details;
rsPeers->getPeerDetails(matrix_info.friend_ids[i], peer_ssl_details);
painter.drawLine(x1,y1,x1,y2);
painter.drawLine(x1,y2,x1 + total_length - i*cellx,y2) ;
painter.drawText(cellx+ x1 + total_length - i*cellx,y2+(0.35)*celly, QString::fromUtf8(peer_ssl_details.name.c_str()) + " - " + QString::fromUtf8(peer_ssl_details.location.c_str()) + " ("+QString::number(current_probs[i])+")");
}
oy += celly * (2+matrix_info.friend_ids.size());
oy += celly ;
oy += celly ;
@ -350,6 +409,24 @@ void GlobalRouterStatisticsWidget::updateContent()
maxHeight = oy ;
}
void GlobalRouterStatisticsWidget::wheelEvent(QWheelEvent *e)
{
if(e->x() < mMinWheelZoneX || e->x() > mMaxWheelZoneX || e->y() < mMinWheelZoneY || e->y() > mMaxWheelZoneY)
{
QWidget::wheelEvent(e) ;
return ;
}
if(e->delta() < 0 && mCurrentN+PARTIAL_VIEW_SIZE/2+1 < mNumberOfKnownKeys)
mCurrentN++ ;
if(e->delta() > 0 && mCurrentN > PARTIAL_VIEW_SIZE/2+1)
mCurrentN-- ;
updateContent();
update();
}
QString GlobalRouterStatisticsWidget::speedString(float f)
{
if(f < 1.0f)

View file

@ -68,6 +68,7 @@ class GlobalRouterStatisticsWidget: public QWidget
virtual void paintEvent(QPaintEvent *event) ;
virtual void resizeEvent(QResizeEvent *event);
virtual void wheelEvent(QWheelEvent *event);
void updateContent() ;
private:
@ -75,5 +76,11 @@ class GlobalRouterStatisticsWidget: public QWidget
QPixmap pixmap ;
int maxWidth,maxHeight ;
int mCurrentN ;
int mNumberOfKnownKeys ;
int mMinWheelZoneX ;
int mMinWheelZoneY ;
int mMaxWheelZoneX ;
int mMaxWheelZoneY ;
};

View file

@ -35,7 +35,7 @@
<x>0</x>
<y>0</y>
<width>593</width>
<height>159</height>
<height>156</height>
</rect>
</property>
</widget>
@ -101,6 +101,11 @@
<string>Send</string>
</property>
</column>
<column>
<property name="text">
<string>Branching factor</string>
</property>
</column>
</widget>
</item>
</layout>

View file

@ -25,9 +25,9 @@
#include "SysTrayStatus.h"
#define IMAGE_NOONLINE ":/images/logo/logo_24_0.png"
#define IMAGE_ONEONLINE ":/images/logo/logo_24_1.png"
#define IMAGE_TWOONLINE ":/images/logo/logo_24_2.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"
SysTrayStatus::SysTrayStatus(QWidget *parent) :
QWidget(parent)
@ -40,7 +40,6 @@ SysTrayStatus::SysTrayStatus(QWidget *parent) :
imageButton->setIcon(QIcon(IMAGE_NOONLINE));
imageButton->setFlat(true);
imageButton->setCheckable(false);
imageButton->setMaximumSize(24, 24);
imageButton->setFocusPolicy(Qt::ClickFocus);
hbox->addWidget(imageButton);

View file

@ -36,9 +36,12 @@ ToasterDisable::ToasterDisable(QWidget *parent)
hbox->setSpacing(0);
imageButton = new QPushButton(this);
int S = QFontMetricsF(imageButton->font()).height();
imageButton->setFlat(true);
imageButton->setCheckable(true);
imageButton->setMaximumSize(24, 24);
imageButton->setMaximumSize(S,S);
imageButton->setFocusPolicy(Qt::ClickFocus);
hbox->addWidget(imageButton);
@ -55,7 +58,7 @@ ToasterDisable::ToasterDisable(QWidget *parent)
void ToasterDisable::disable(bool isDisable)
{
imageButton->setIcon(QIcon(isDisable ? IMAGE_TOASTERDISABLE : IMAGE_TOASTERENABLE));
imageButton->setIcon(QPixmap(isDisable ? IMAGE_TOASTERDISABLE : IMAGE_TOASTERENABLE));
imageButton->setToolTip(isDisable ? tr("All Toasters are disabled") : tr("Toasters are enabled"));
imageButton->setChecked(isDisable);
}

View file

@ -40,10 +40,13 @@ DHTStatus::DHTStatus(QWidget *parent)
hbox->setSpacing(6);
statusDHT = new QLabel("<strong>" + tr("DHT") + ":</strong>", this );
statusDHT->setToolTip(tr("<p>Retroshare uses Bittorrent's DHT as a proxy for connexions. It does not \"store\" your IP in the DHT. \
Instead the DHT is used by your friends to reach you while processing standard DHT requests. \
The status bullet will turn green as soon as Retroshare gets a DHT response from one of your friends.</p>")) ;
hbox->addWidget(statusDHT);
dhtstatusLabel = new QLabel( this );
dhtstatusLabel->setPixmap(QPixmap(":/images/grayled.png"));
dhtstatusLabel->setPixmap(QPixmap(":/icons/bullet_grey_128.png"));
hbox->addWidget(dhtstatusLabel);
spaceLabel = new QLabel( "|", this );
@ -52,7 +55,8 @@ DHTStatus::DHTStatus(QWidget *parent)
dhtnetworkLabel = new QLabel( this );
dhtnetworkLabel->setVisible(false);
dhtnetworkLabel->setPixmap(QPixmap(":/images/dht16.png"));
int S = QFontMetricsF(dhtnetworkLabel->font()).height();
dhtnetworkLabel->setPixmap(QPixmap(":/images/dht32.png").scaledToHeight(S,Qt::SmoothTransformation));
hbox->addWidget(dhtnetworkLabel);
dhtnetworksizeLabel = new QLabel( "0 (0) ",this );
@ -125,7 +129,7 @@ void DHTStatus::getDHTStatus()
{
// RED - some issue.
dhtstatusLabel->setPixmap(QPixmap(":/icons/bullet_red_128.png").scaledToHeight(S,Qt::SmoothTransformation));
dhtstatusLabel->setToolTip( text + tr("DHT Error"));
dhtstatusLabel->setToolTip( text + tr("No peer found in DHT"));
spaceLabel->setVisible(false);
dhtnetworkLabel->setVisible(false);

View file

@ -31,13 +31,13 @@ PeerStatus::PeerStatus(QWidget *parent)
hbox->setMargin(0);
hbox->setSpacing(6);
iconLabel = new QLabel( this );
iconLabel->setPixmap(QPixmap(":/images/user/identitygray16.png"));
// iconLabel doesn't change over time, so we didn't need a minimum size
int S = QFontMetricsF(iconLabel->font()).height();
iconLabel->setPixmap(QPixmap(":/icons/avatar_grey_128.png").scaledToHeight(S,Qt::SmoothTransformation));
hbox->addWidget(iconLabel);
statusPeers = new QLabel( tr("Friends: 0/0"), this );
// statusPeers->setMinimumSize( statusPeers->frameSize().width() + 0, 0 );
hbox->addWidget(statusPeers);
_compactMode = false;
@ -48,22 +48,19 @@ PeerStatus::PeerStatus(QWidget *parent)
void PeerStatus::getPeerStatus(unsigned int nFriendCount, unsigned int nOnlineCount)
{
/* set users/friends/network */
/* set users/friends/network */
if (statusPeers){
statusPeers->setToolTip(tr("Online Friends/Total Friends") );
QString text;
if (_compactMode) text = QString("%1/%2").arg(nOnlineCount).arg(nFriendCount);
else text = QString("<strong>%1:</strong> %2/%3 ").arg(tr("Friends")).arg(nOnlineCount).arg(nFriendCount);
statusPeers -> setText(text);
}
if (statusPeers){
statusPeers->setToolTip(tr("Online Friends/Total Friends") );
QString text;
if (_compactMode) text = QString("%1/%2").arg(nOnlineCount).arg(nFriendCount);
else text = QString("<strong>%1:</strong> %2/%3 ").arg(tr("Friends")).arg(nOnlineCount).arg(nFriendCount);
statusPeers -> setText(text);
}
int S = QFontMetricsF(iconLabel->font()).height();
if (nOnlineCount > 0)
{
iconLabel->setPixmap(QPixmap(":/images/user/identity16.png"));
}
else
{
iconLabel->setPixmap(QPixmap(":/images/user/identitygray16.png"));
}
if (nOnlineCount > 0)
iconLabel->setPixmap(QPixmap(":/icons/avatar_128.png").scaledToHeight(S,Qt::SmoothTransformation));
else
iconLabel->setPixmap(QPixmap(":/icons/avatar_grey_128.png").scaledToHeight(S,Qt::SmoothTransformation));
}