fixed merge with master

This commit is contained in:
csoler 2018-02-12 22:40:15 +01:00
commit d8b193c10b
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
111 changed files with 7300 additions and 308 deletions

View file

@ -225,9 +225,10 @@ void AWidget::initImages()
//p.drawPixmap(QRect(10, 10, width()-10, 60), image);
/* Draw RetroShare version */
p.drawText(QPointF(10, 50), QString("%1 : %2").arg(tr("Retroshare version"), Rshare::retroshareVersion(true)));
#ifdef RS_ONLYHIDDENNODE
p.drawText(QPointF(10, 70), QString("Only Hidden Node"));
p.drawText(QPointF(10, 50), QString("%1 : %2 (With embedded Tor)").arg(tr("Retroshare version"), Rshare::retroshareVersion(true)));
#else
p.drawText(QPointF(10, 50), QString("%1 : %2").arg(tr("Retroshare version"), Rshare::retroshareVersion(true)));
#endif
/* Draw Qt's version number */

View file

@ -195,6 +195,10 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent)
ui.nodeType_CB->setCurrentIndex(1);
ui.nodeType_CB->setEnabled(false);
#endif
#ifdef RETROTOR
ui.adv_checkbox->setChecked(false);
ui.adv_checkbox->setVisible(true);
#endif
initKeyList();
setupState();
@ -255,10 +259,16 @@ void GenCertDialog::setupState()
{
bool adv_state = ui.adv_checkbox->isChecked();
#ifdef RETROTOR
bool retrotor = true ;
#else
bool retrotor = false ;
#endif
if(!adv_state)
{
ui.reuse_existing_node_CB->setChecked(false) ;
ui.nodeType_CB->setCurrentIndex(0) ;
ui.nodeType_CB->setCurrentIndex(retrotor?1:0) ;
ui.keylength_comboBox->setCurrentIndex(0) ;
}
bool hidden_state = ui.nodeType_CB->currentIndex()==1;
@ -271,8 +281,8 @@ void GenCertDialog::setupState()
setWindowTitle(generate_new?tr("Create new profile and new Retroshare node"):tr("Create new Retroshare node"));
//ui.headerFrame->setHeaderText(generate_new?tr("Create a new profile and node"):tr("Create a new node"));
ui.label_nodeType->setVisible(adv_state) ;
ui.nodeType_CB->setVisible(adv_state) ;
ui.label_nodeType->setVisible(adv_state && !retrotor) ;
ui.nodeType_CB->setVisible(adv_state && !retrotor) ;
ui.reuse_existing_node_CB->setEnabled(adv_state) ;
ui.importIdentity_PB->setVisible(adv_state && !generate_new) ;
ui.exportIdentity_PB->setVisible(adv_state && !generate_new) ;
@ -308,13 +318,13 @@ void GenCertDialog::setupState()
ui.entropy_bar->setVisible(true);
ui.genButton->setVisible(true);
ui.hiddenaddr_input->setVisible(hidden_state);
ui.hiddenaddr_label->setVisible(hidden_state);
ui.hiddenaddr_input->setVisible(hidden_state && !retrotor);
ui.hiddenaddr_label->setVisible(hidden_state && !retrotor);
ui.hiddenport_label->setVisible(hidden_state);
ui.hiddenport_spinBox->setVisible(hidden_state);
ui.hiddenport_label->setVisible(hidden_state && !retrotor);
ui.hiddenport_spinBox->setVisible(hidden_state && !retrotor);
ui.cbUseBob->setVisible(hidden_state);
ui.cbUseBob->setVisible(hidden_state && !retrotor);
if(!mAllFieldsOk)
{

View file

@ -83,6 +83,7 @@
#include "statusbar/SoundStatus.h"
#include "statusbar/ToasterDisable.h"
#include "statusbar/SysTrayStatus.h"
#include "statusbar/torstatus.h"
#include <retroshare/rsstatus.h>
#include <retroshare/rsiface.h>
@ -244,18 +245,37 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
peerstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowPeer", QVariant(true)).toBool());
statusBar()->addWidget(peerstatus);
natstatus = new NATStatus();
if(hiddenmode) natstatus->setVisible(false);
else natstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowNAT", QVariant(true)).toBool());
statusBar()->addWidget(natstatus);
natstatus->getNATStatus();
dhtstatus = new DHTStatus();
if(hiddenmode) dhtstatus->setVisible(false);
else dhtstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowDHT", QVariant(true)).toBool());
statusBar()->addWidget(dhtstatus);
dhtstatus->getDHTStatus();
if(hiddenmode)
{
#ifdef RETROTOR
torstatus = new TorStatus();
torstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowTor", QVariant(true)).toBool());
statusBar()->addWidget(torstatus);
torstatus->getTorStatus();
#else
torstatus = NULL ;
#endif
natstatus = NULL ;
dhtstatus = NULL ;
}
else
{
torstatus = NULL ;
natstatus = new NATStatus();
if(hiddenmode) natstatus->setVisible(false);
else natstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowNAT", QVariant(true)).toBool());
statusBar()->addWidget(natstatus);
natstatus->getNATStatus();
dhtstatus = new DHTStatus();
if(hiddenmode) dhtstatus->setVisible(false);
else dhtstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowDHT", QVariant(true)).toBool());
statusBar()->addWidget(dhtstatus);
dhtstatus->getDHTStatus();
}
hashingstatus = new HashingStatus();
hashingstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowHashing", QVariant(true)).toBool());
statusBar()->addPermanentWidget(hashingstatus, 1);
@ -710,6 +730,9 @@ void MainWindow::updateStatus()
if (ratesstatus)
ratesstatus->getRatesStatus(downKb, upKb);
if(torstatus)
torstatus->getTorStatus();
if(!hiddenmode)
{
if (natstatus)
@ -1594,6 +1617,10 @@ void MainWindow::setCompactStatusMode(bool compact)
dhtstatus->setCompactMode(compact);
dhtstatus->getDHTStatus();
}
if(torstatus)
torstatus->setCompactMode(compact) ;
hashingstatus->setCompactMode(compact);
ratesstatus->setCompactMode(compact);
//opModeStatus: TODO Show only ???

View file

@ -46,6 +46,7 @@ class OpModeStatus;
class SoundStatus;
class ToasterDisable;
class SysTrayStatus;
class TorStatus ;
//class ForumsDialog;
class GxsChannelDialog ;
class GxsForumsDialog ;
@ -293,6 +294,7 @@ private:
SoundStatus *soundStatus;
ToasterDisable *toasterDisable;
SysTrayStatus *sysTrayStatus;
TorStatus *torstatus;
/* Status */
std::set <QObject*> m_apStatusObjects; // added objects for status

View file

@ -1,6 +1,8 @@
#ifndef PGPID_ITEM_PROXY_H
#define PGPID_ITEM_PROXY_H
#include "util/cxx11retrocompat.h"
#include <QSortFilterProxyModel>
class pgpid_item_proxy :

View file

@ -46,7 +46,8 @@
#include "util/HandleRichText.h"
#include "util/QtVersion.h"
#include <retroshare/rsnotify.h>
#include "retroshare/rsnotify.h"
#include "util/rstime.h"
#include <time.h>
#include <unistd.h>
@ -339,7 +340,7 @@ void ChatLobbyDialog::init(const ChatId &/*id*/, const QString &/*title*/)
if(rsIdentity->getIdDetails(gxs_id,details))
break ;
else
usleep(1000*300) ;
rstime::rs_usleep(1000*300) ;
ui.chatWidget->setName(QString::fromUtf8(details.mNickname.c_str()));
//ui.chatWidget->addToolsAction(ui.actionChangeNickname);

View file

@ -342,7 +342,8 @@ void FriendList::peerTreeWidgetCustomPopupMenu()
// QMenu *lobbyMenu = NULL;
switch (type) {
switch (type)
{
case TYPE_GROUP:
{
bool standard = c->data(COLUMN_DATA, ROLE_STANDARD).toBool();
@ -448,11 +449,11 @@ void FriendList::peerTreeWidgetCustomPopupMenu()
contextMenu->addAction(QIcon(IMAGE_EXPORTFRIEND), tr("Recommend this node to..."), this, SLOT(recommendfriend()));
}
contextMenu->addAction(QIcon(IMAGE_CONNECT), tr("Attempt to connect"), this, SLOT(connectfriend()));
if(!rsPeers->isHiddenNode(rsPeers->getOwnId()) || rsPeers->isHiddenNode( RsPeerId(getRsId(c)) ))
contextMenu->addAction(QIcon(IMAGE_CONNECT), tr("Attempt to connect"), this, SLOT(connectfriend()));
contextMenu->addAction(QIcon(IMAGE_COPYLINK), tr("Copy certificate link"), this, SLOT(copyFullCertificate()));
//this is a SSL key
contextMenu->addAction(QIcon(IMAGE_REMOVEFRIEND), tr("Remove Friend Node"), this, SLOT(removefriend()));

View file

@ -45,11 +45,12 @@
#define IDDIALOG_IDLIST 1
#define ROLE_ID Qt::UserRole
#define ROLE_SORT_GROUP Qt::UserRole + 1
#define ROLE_SORT_STANDARD_GROUP Qt::UserRole + 2
#define ROLE_SORT_NAME Qt::UserRole + 3
#define ROLE_SORT_STATE Qt::UserRole + 4
#define ROLE_ID Qt::UserRole
#define ROLE_SORT_GROUP Qt::UserRole + 1
#define ROLE_SORT_STANDARD_GROUP Qt::UserRole + 2
#define ROLE_SORT_NAME Qt::UserRole + 3
#define ROLE_SORT_STATE Qt::UserRole + 4
#define ROLE_FILTER_REASON Qt::UserRole + 5
#define IMAGE_GROUP16 ":/images/user/group16.png"
#define IMAGE_FRIENDINFO ":/images/peerdetails_16x16.png"
@ -109,10 +110,15 @@ FriendSelectionWidget::FriendSelectionWidget(QWidget *parent)
mActionSortByState->setCheckable(true);
connect(mActionSortByState, SIGNAL(toggled(bool)), this, SLOT(sortByState(bool)));
ui->friendList->addContextMenuAction(mActionSortByState);
mActionFilterConnected = new QAction(tr("Filter only connected"), this);
mActionFilterConnected->setCheckable(true);
connect(mActionFilterConnected, SIGNAL(toggled(bool)), this, SLOT(filterConnected(bool)));
ui->friendList->addContextMenuAction(mActionFilterConnected);
/* initialize list */
ui->friendList->setColumnCount(COLUMN_COUNT);
ui->friendList->headerItem()->setText(COLUMN_NAME, tr("Name"));
ui->friendList->setFilterReasonRole(ROLE_FILTER_REASON);
/* sort list by name ascending */
ui->friendList->sortItems(COLUMN_NAME, Qt::AscendingOrder);
@ -216,8 +222,8 @@ static void initSslItem(QTreeWidgetItem *item, const RsPeerDetails &detail, cons
item->setData(COLUMN_NAME, ROLE_SORT_GROUP, 1);
item->setData(COLUMN_NAME, ROLE_SORT_STANDARD_GROUP, 0);
item->setData(COLUMN_NAME, ROLE_SORT_STATE, (state != (int) RS_STATUS_OFFLINE) ? 0 : 1);
item->setData(COLUMN_NAME, ROLE_SORT_NAME, name);
item->setData(COLUMN_NAME, ROLE_SORT_STATE, state);
}
void FriendSelectionWidget::fillList()
@ -359,8 +365,8 @@ void FriendSelectionWidget::secured_fillList()
groupItem->setData(COLUMN_NAME, ROLE_SORT_GROUP, 0);
groupItem->setData(COLUMN_NAME, ROLE_SORT_STANDARD_GROUP, (groupInfo->flag & RS_GROUP_FLAG_STANDARD) ? 0 : 1);
groupItem->setData(COLUMN_NAME, ROLE_SORT_STATE, 0);
groupItem->setData(COLUMN_NAME, ROLE_SORT_NAME, groupName);
groupItem->setData(COLUMN_NAME, ROLE_SORT_STATE, 0);
if (mListModus == MODUS_CHECK) {
groupItem->setCheckState(0, Qt::Unchecked);
@ -426,8 +432,8 @@ void FriendSelectionWidget::secured_fillList()
gpgItem->setData(COLUMN_NAME, ROLE_SORT_GROUP, 1);
gpgItem->setData(COLUMN_NAME, ROLE_SORT_STANDARD_GROUP, 0);
gpgItem->setData(COLUMN_NAME, ROLE_SORT_STATE, (state != (int) RS_STATUS_OFFLINE) ? 0 : 1);
gpgItem->setData(COLUMN_NAME, ROLE_SORT_NAME, name);
gpgItem->setData(COLUMN_NAME, ROLE_SORT_STATE, state);
if (mListModus == MODUS_CHECK) {
gpgItem->setCheckState(0, Qt::Unchecked);
@ -561,9 +567,9 @@ void FriendSelectionWidget::secured_fillList()
gxsItem->setData(COLUMN_NAME, ROLE_SORT_GROUP, 1);
gxsItem->setData(COLUMN_NAME, ROLE_SORT_STANDARD_GROUP, 0);
gxsItem->setData(COLUMN_NAME, ROLE_SORT_NAME, name);
//TODO: online state for gxs items
gxsItem->setData(COLUMN_NAME, ROLE_SORT_STATE, 1);
gxsItem->setData(COLUMN_NAME, ROLE_SORT_NAME, name);
if (mListModus == MODUS_CHECK)
gxsItem->setCheckState(0, Qt::Unchecked);
@ -615,9 +621,9 @@ void FriendSelectionWidget::secured_fillList()
gxsItem->setData(COLUMN_NAME, ROLE_SORT_GROUP, 1);
gxsItem->setData(COLUMN_NAME, ROLE_SORT_STANDARD_GROUP, 0);
gxsItem->setData(COLUMN_NAME, ROLE_SORT_NAME, name);
//TODO: online state for gxs items
gxsItem->setData(COLUMN_NAME, ROLE_SORT_STATE, 1);
gxsItem->setData(COLUMN_NAME, ROLE_SORT_NAME, name);
if (mListModus == MODUS_CHECK)
gxsItem->setCheckState(0, Qt::Unchecked);
@ -650,6 +656,7 @@ void FriendSelectionWidget::secured_fillList()
mInFillList = false;
ui->friendList->resort();
filterConnected(isFilterConnected());
emit contentChanged();
}
@ -751,7 +758,7 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
item->setTextColor(COLUMN_NAME, color);
item->setIcon(COLUMN_NAME, QIcon(StatusDefs::imageUser(gpgStatus)));
item->setData(COLUMN_NAME, ROLE_SORT_STATE, (gpgStatus != (int) RS_STATUS_OFFLINE) ? 0 : 1);
item->setData(COLUMN_NAME, ROLE_SORT_STATE, gpgStatus);
bFoundGPG = true;
}
@ -770,7 +777,7 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
item->setTextColor(COLUMN_NAME, color);
item->setIcon(COLUMN_NAME, QIcon(StatusDefs::imageUser(status)));
item->setData(COLUMN_NAME, ROLE_SORT_STATE, (status != (int) RS_STATUS_OFFLINE) ? 0 : 1);
item->setData(COLUMN_NAME, ROLE_SORT_STATE, status);
bFoundSSL = true;
}
@ -799,6 +806,7 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
}
ui->friendList->resort();
filterConnected(isFilterConnected());
}
void FriendSelectionWidget::addContextMenuAction(QAction *action)
@ -810,7 +818,7 @@ void FriendSelectionWidget::contextMenuRequested(const QPoint &/*pos*/)
{
QMenu *contextMenu = new QMenu(this);
if (mListModus == MODUS_CHECK) {
if (mListModus == MODUS_MULTI) {
contextMenu->addAction(QIcon(), tr("Mark all"), this, SLOT(selectAll()));
contextMenu->addAction(QIcon(), tr("Mark none"), this, SLOT(deselectAll()));
}
@ -953,37 +961,9 @@ void FriendSelectionWidget::itemChanged(QTreeWidgetItem *item, int column)
void FriendSelectionWidget::filterItems(const QString& text)
{
int count = ui->friendList->topLevelItemCount();
for (int index = 0; index < count; ++index) {
filterItem(ui->friendList->topLevelItem(index), text);
}
}
bool FriendSelectionWidget::filterItem(QTreeWidgetItem *item, const QString &text)
{
bool visible = true;
if (text.isEmpty() == false) {
if (item->text(0).contains(text, Qt::CaseInsensitive) == false) {
visible = false;
}
}
int visibleChildCount = 0;
int count = item->childCount();
for (int index = 0; index < count; ++index) {
if (filterItem(item->child(index), text)) {
++visibleChildCount;
}
}
if (visible || visibleChildCount) {
item->setHidden(false);
} else {
item->setHidden(true);
}
return (visible || visibleChildCount);
ui->friendList->filterItems(COLUMN_NAME, text);
ui->friendList->resort();
filterConnected(isFilterConnected());
}
int FriendSelectionWidget::selectedItemCount()
@ -1168,9 +1148,24 @@ void FriendSelectionWidget::sortByState(bool sort)
mActionSortByState->setChecked(sort);
ui->friendList->resort();
filterConnected(isFilterConnected());
}
bool FriendSelectionWidget::isSortByState()
{
return mActionSortByState->isChecked();
}
void FriendSelectionWidget::filterConnected(bool filter)
{
ui->friendList->filterMinValItems(COLUMN_NAME, filter ? RS_STATUS_AWAY : RS_STATUS_OFFLINE, ROLE_SORT_STATE);
mActionFilterConnected->setChecked(filter);
ui->friendList->resort();
}
bool FriendSelectionWidget::isFilterConnected()
{
return mActionFilterConnected->isChecked();
}

View file

@ -82,6 +82,7 @@ public:
void start();
bool isSortByState();
bool isFilterConnected();
int selectedItemCount();
std::string selectedId(IdType &idType);
@ -130,6 +131,7 @@ signals:
public slots:
void sortByState(bool sort);
void filterConnected(bool filter);
private slots:
void groupsChanged(int type);
@ -144,7 +146,6 @@ private slots:
private:
void fillList();
void secured_fillList();
bool filterItem(QTreeWidgetItem *item, const QString &text);
void selectedIds(IdType idType, std::set<std::string> &ids, bool onlyDirectSelected);
void setSelectedIds(IdType idType, const std::set<std::string> &ids, bool add);
@ -161,6 +162,7 @@ private:
bool mInSslItemChanged;
bool mInFillList;
QAction *mActionSortByState;
QAction *mActionFilterConnected;
/* Color definitions (for standard see qss.default) */
QColor mTextColorOnline;

View file

@ -34,6 +34,7 @@ RSTreeWidget::RSTreeWidget(QWidget *parent) : QTreeWidget(parent)
{
mEnableColumnCustomize = false;
mSettingsVersion = 0; // disabled
mFilterReasonRole = -1; // disabled
QHeaderView *h = header();
h->setContextMenuPolicy(Qt::CustomContextMenu);
@ -84,6 +85,12 @@ void RSTreeWidget::mousePressEvent(QMouseEvent *event)
QTreeWidget::mousePressEvent(event);
}
void RSTreeWidget::setFilterReasonRole(int role /*=-1*/)
{
if (role > Qt::UserRole)
mFilterReasonRole = role;
}
void RSTreeWidget::filterItems(int filterColumn, const QString &text, int role)
{
int count = topLevelItemCount();
@ -101,6 +108,13 @@ void RSTreeWidget::filterItems(int filterColumn, const QString &text, int role)
bool RSTreeWidget::filterItem(QTreeWidgetItem *item, int filterColumn, const QString &text, int role)
{
bool itemVisible = true;
//Get who hide this item
int filterReason = 0;
if (mFilterReasonRole >= Qt::UserRole)
filterReason = item->data(filterColumn, mFilterReasonRole).toInt();
//Remove this filter for last test
if (filterReason & FILTER_REASON_TEXT)
filterReason -= FILTER_REASON_TEXT;
if (!text.isEmpty()) {
if (!item->data(filterColumn, role).toString().contains(text, Qt::CaseInsensitive)) {
@ -116,11 +130,62 @@ bool RSTreeWidget::filterItem(QTreeWidgetItem *item, int filterColumn, const QSt
}
}
if (itemVisible || visibleChildCount) {
item->setHidden(false);
} else {
item->setHidden(true);
if (!itemVisible && !visibleChildCount) {
filterReason |= FILTER_REASON_TEXT;
}
item->setHidden(filterReason != 0);
//Update hiding reason
if (mFilterReasonRole >= Qt::UserRole)
item->setData(filterColumn, mFilterReasonRole, filterReason);
return (itemVisible || visibleChildCount);
}
void RSTreeWidget::filterMinValItems(int filterColumn, const double &value, int role)
{
int count = topLevelItemCount();
for (int index = 0; index < count; ++index) {
filterMinValItem(topLevelItem(index), filterColumn, value, role);
}
QTreeWidgetItem *item = currentItem();
if (item && item->isHidden()) {
// active item is hidden, deselect it
setCurrentItem(NULL);
}
}
bool RSTreeWidget::filterMinValItem(QTreeWidgetItem *item, int filterColumn, const double &value, int role)
{
bool itemVisible = true;
//Get who hide this item
int filterReason = 0;
if (mFilterReasonRole >= Qt::UserRole)
filterReason = item->data(filterColumn, mFilterReasonRole).toInt();
//Remove this filter for last test
if (filterReason & FILTER_REASON_MINVAL)
filterReason -= FILTER_REASON_MINVAL;
bool ok = false;
if ((item->data(filterColumn, role).toDouble(&ok) < value) && ok ) {
itemVisible = false;
}
int visibleChildCount = 0;
int count = item->childCount();
for (int index = 0; index < count; ++index) {
if (filterMinValItem(item->child(index), filterColumn, value, role)) {
++visibleChildCount;
}
}
if (!itemVisible && !visibleChildCount) {
filterReason |= FILTER_REASON_MINVAL;
}
item->setHidden(filterReason != 0);
//Update hiding reason
if (mFilterReasonRole >= Qt::UserRole)
item->setData(filterColumn, mFilterReasonRole, filterReason);
return (itemVisible || visibleChildCount);
}
@ -294,6 +359,6 @@ void RSTreeWidget::columnVisible()
void RSTreeWidget::resort()
{
if (isSortingEnabled()) {
sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
sortItems(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
}
}

View file

@ -24,6 +24,9 @@
#include <QTreeWidget>
#define FILTER_REASON_TEXT 0x0001
#define FILTER_REASON_MINVAL 0x0002
/* Subclassing QTreeWidget */
class RSTreeWidget : public QTreeWidget
{
@ -35,7 +38,9 @@ public:
QString placeholderText() { return mPlaceholderText; }
void setPlaceholderText(const QString &text);
void setFilterReasonRole(int role = -1);
void filterItems(int filterColumn, const QString &text, int role = Qt::DisplayRole);
void filterMinValItems(int filterColumn, const double &value, int role = Qt::DisplayRole);
void setSettingsVersion(qint32 version);
void processSettings(bool load);
@ -58,6 +63,7 @@ signals:
private:
bool filterItem(QTreeWidgetItem *item, int filterColumn, const QString &text, int role);
bool filterMinValItem(QTreeWidgetItem *item, int filterColumn, const double &value, int role);
private slots:
void headerContextMenuRequested(const QPoint &pos);
@ -74,6 +80,7 @@ private:
QMap<int, bool> mColumnCustomizable;
QList<QAction*> mContextMenuActions;
QList<QMenu*> mContextMenuMenus;
int mFilterReasonRole;
};
#endif

View file

@ -435,15 +435,29 @@ void ConnectFriendWizard::initializePage(int id)
break;
case Page_Conclusion:
{
bool peerIsHiddenNode = peerDetails.isHiddenNode ;
bool amIHiddenNode = rsPeers->isHiddenNode(rsPeers->getOwnId()) ;
std::cerr << "Conclusion page id : " << peerDetails.id << "; gpg_id : " << peerDetails.gpg_id << std::endl;
ui->_direct_transfer_CB_2 ->setChecked(false) ; //peerDetails.service_perm_flags & RS_NODE_PERM_DIRECT_DL) ;
ui->_allow_push_CB_2 ->setChecked(peerDetails.service_perm_flags & RS_NODE_PERM_ALLOW_PUSH) ;
ui->_require_WL_CB_2 ->setChecked(peerDetails.service_perm_flags & RS_NODE_PERM_REQUIRE_WL) ;
if(!peerIsHiddenNode && !amIHiddenNode)
ui->_require_WL_CB_2 ->setChecked(peerDetails.service_perm_flags & RS_NODE_PERM_REQUIRE_WL) ;
else
{
ui->_require_WL_CB_2 ->setChecked(false) ;
ui->_require_WL_CB_2 ->hide() ;
ui->_addIPToWhiteList_CB_2->hide();
ui->_addIPToWhiteList_ComboBox_2->hide();
}
sockaddr_storage addr ;
std::cerr << "Cert IP = " << peerDetails.extAddr << std::endl;
std::cerr << "Cert IP = " << peerDetails.extAddr << std::endl;
if(sockaddr_storage_ipv4_aton(addr,peerDetails.extAddr.c_str()) && sockaddr_storage_isValidNet(addr))
{
QString ipstring0 = QString::fromStdString(sockaddr_storage_iptostring(addr));
@ -577,29 +591,28 @@ void ConnectFriendWizard::initializePage(int id)
ui->fr_avatar->setFrameType(AvatarWidget::NORMAL_FRAME);
setPixmap(QWizard::LogoPixmap, QPixmap(":/images/user/user_request48.png"));
ui->fr_signGPGCheckBox->setChecked(false);
//set the radio button to sign the GPG key
if (peerDetails.accept_connection && !peerDetails.ownsign) {
//gpg key connection is already accepted, don't propose to accept it again
ui->fr_signGPGCheckBox->setChecked(false);
ui->fr_acceptNoSignGPGCheckBox->hide();
ui->fr_signGPGCheckBox->show();
ui->fr_acceptNoSignGPGCheckBox->setChecked(false);
}
if (!peerDetails.accept_connection && peerDetails.ownsign) {
//gpg key is already signed, don't propose to sign it again
ui->fr_acceptNoSignGPGCheckBox->setChecked(true);
ui->fr_signGPGCheckBox->hide();
ui->fr_signGPGCheckBox->setChecked(false);
}
if (!peerDetails.accept_connection && !peerDetails.ownsign) {
ui->fr_acceptNoSignGPGCheckBox->setChecked(true);
ui->fr_signGPGCheckBox->show();
ui->fr_signGPGCheckBox->setChecked(false);
ui->fr_acceptNoSignGPGCheckBox->show();
}
if (peerDetails.accept_connection && peerDetails.ownsign) {
ui->fr_acceptNoSignGPGCheckBox->setChecked(false);
ui->fr_acceptNoSignGPGCheckBox->hide();
ui->fr_signGPGCheckBox->setChecked(false);
ui->fr_signGPGCheckBox->hide();
}

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>760</width>
<height>538</height>
<width>1161</width>
<height>1223</height>
</rect>
</property>
<property name="windowTitle">

View file

@ -64,6 +64,9 @@ ConnectProgressDialog::ConnectProgressDialog(const RsPeerId& id, QWidget *parent
ui->headerFrame->setHeaderText(tr("Connection Assistant"));
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(stopAndClose()));
mAmIHiddenNode = rsPeers->isHiddenNode(rsPeers->getOwnId()) ;
mIsPeerHiddenNode = rsPeers->isHiddenNode(id) ;
}
ConnectProgressDialog::~ConnectProgressDialog()
@ -165,15 +168,35 @@ void ConnectProgressDialog::initDialog()
ui->NetResult->setText(tr("N/A"));
ui->ContactResult->setText(tr("N/A"));
#ifdef RS_USE_BITDHT
if(!mIsPeerHiddenNode && !mAmIHiddenNode)
{
ui->DhtResult->setText(tr("DHT Startup"));
ui->DhtProgressBar->setValue(0);
}
#else
if(mIsPeerHiddenNode || mAmIHiddenNode)
{
ui->DhtResult->hide();
ui->DhtLabel->hide();
ui->DhtProgressBar->hide();
}
#endif
if(mIsPeerHiddenNode || mAmIHiddenNode)
{
ui->UdpResult->hide();
ui->UdpProgressBar->hide();
ui->UdpLabel->hide();
}
else
{
ui->UdpResult->setText(tr("N/A"));
ui->UdpProgressBar->setValue(0);
}
ui->LookupResult->setText(tr("N/A"));
ui->LookupProgressBar->setValue(0);
ui->UdpResult->setText(tr("N/A"));
ui->UdpProgressBar->setValue(0);
sayInProgress();
if (rsPeers->isFriend(mId))
@ -219,7 +242,9 @@ void ConnectProgressDialog::updateStatus()
updateNetworkStatus();
updateContactStatus();
#ifdef RS_USE_BITDHT
updateDhtStatus();
#endif
updateLookupStatus();
updateUdpStatus();
@ -443,6 +468,7 @@ void ConnectProgressDialog::updateLookupStatus()
break;
}
#ifdef RS_USE_BITDHT
time_t now = time(NULL);
switch(mDhtStatus)
{
@ -520,6 +546,7 @@ void ConnectProgressDialog::updateLookupStatus()
mLookupStatus = CONNECT_LOOKUP_ONLINE;
break;
}
#endif
}
@ -572,6 +599,7 @@ void ConnectProgressDialog::updateUdpStatus()
ui->UdpProgressBar->setValue(calcProgress(now, mUdpTS, CONNECT_UDP_TYPICAL, CONNECT_UDP_SLOW, CONNECT_UDP_PERIOD));
#ifdef RS_USE_BITDHT
/* now lookup details from Dht */
RsDhtNetPeer status;
rsDht->getNetPeerStatus(mId, status);
@ -599,6 +627,7 @@ void ConnectProgressDialog::updateUdpStatus()
}
}
}
#endif
}

View file

@ -97,6 +97,9 @@ private:
time_t mUdpTS;
uint32_t mUdpStatus;
bool mAmIHiddenNode ;
bool mIsPeerHiddenNode ;
/** Qt Designer generated object */
Ui::ConnectProgressDialog *ui;
};

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>553</width>
<height>489</height>
<width>623</width>
<height>608</height>
</rect>
</property>
<property name="windowTitle">
@ -21,7 +21,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>
@ -97,7 +106,7 @@
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="DhtLabel">
<property name="font">
<font>
<weight>75</weight>
@ -117,7 +126,7 @@
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_6">
<widget class="QLabel" name="LookupLabel">
<property name="font">
<font>
<weight>75</weight>
@ -137,7 +146,7 @@
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_7">
<widget class="QLabel" name="UdpLabel">
<property name="font">
<font>
<weight>75</weight>
@ -283,10 +292,10 @@
<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:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&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:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:13pt;&quot;&gt;This Widget shows the progress of your connection to your new peer.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:13pt;&quot;&gt;It is helpful for problem-solving.&lt;/span&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; font-family:'Lucida Grande'; font-size:13pt;&quot;&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; font-family:'Lucida Grande'; font-size:13pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:13pt;&quot;&gt;If you are an expert RS user, or trust that RS will do the right thing&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:13pt;&quot;&gt;you can close it.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
@ -331,7 +340,6 @@ p, li { white-space: pre-wrap; }
</customwidgets>
<resources>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/">
<file>icons/onion.png</file>
<file>icons/svg/hidden.svg</file>
<file>icons/svg/randomness.svg</file>
<file>icons/svg/password.svg</file>
@ -227,6 +228,7 @@
<file>icons/tor-logo.png</file>
<file>icons/tor-off.png</file>
<file>icons/tor-on.png</file>
<file>icons/no-tor.png</file>
<file>icons/tor-starting.png</file>
<file>icons/tor-stopping.png</file>
<file>icons/user-away_64.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -366,13 +366,6 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkBoxShowDHTStatus">
<property name="text">
<string>Show DHT Status</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="checkBoxShowHashingStatus">
<property name="text">
@ -380,13 +373,6 @@
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="checkBoxShowNATStatus">
<property name="text">
<string>Show NAT Status</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="checkBoxShowPeerStatus">
<property name="text">
@ -418,17 +404,31 @@
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QCheckBox" name="checkBoxShowSystrayOnStatus">
<item row="2" column="2">
<widget class="QCheckBox" name="checkBoxShowNATStatus">
<property name="text">
<string>Show SysTray on Status Bar</string>
<string>Show NAT Status</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="checkBoxShowOpModeStatus">
<property name="text">
<string>Show Operating Mode Status</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QCheckBox" name="checkBoxShowOpModeStatus">
<widget class="QCheckBox" name="checkBoxShowDHTStatus">
<property name="text">
<string>Show Operating Mode Status</string>
<string>Show DHT Status</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkBoxShowSystrayOnStatus">
<property name="text">
<string>Show SysTray on Status Bar</string>
</property>
</widget>
</item>

View file

@ -59,7 +59,26 @@
///
/// \brief hiddenServiceIncomingTab index of hidden serice incoming tab
///
const static uint32_t hiddenServiceIncomingTab = 2;
///
// Tabs numbers *after* non relevant tabs are removed. So do not use them to add/remove tabs!!
#ifdef RETROTOR
static const uint32_t TAB_HIDDEN_SERVICE_OUTGOING = 0;
static const uint32_t TAB_HIDDEN_SERVICE_INCOMING = 1;
static const uint32_t TAB_NETWORK = 0;
static const uint32_t TAB_HIDDEN_SERVICE = 1;
static const uint32_t TAB_IP_FILTERS = 99; // This is a trick: these tabs do not exist, so enabling/disabling them has no effect
static const uint32_t TAB_RELAYS = 99;
#else
const static uint32_t TAB_HIDDEN_SERVICE_OUTGOING = 0;
const static uint32_t TAB_HIDDEN_SERVICE_INCOMING = 2;
const static uint32_t TAB_NETWORK = 0;
const static uint32_t TAB_IP_FILTERS = 1;
const static uint32_t TAB_HIDDEN_SERVICE = 2;
const static uint32_t TAB_RELAYS = 3;
#endif
//#define SERVER_DEBUG 1
@ -71,6 +90,26 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
manager = NULL ;
#ifdef RETROTOR
// Here we use absolute numbers instead of consts defined above, because the consts correspond to the tab number *after* this tab removal.
ui.tabWidget->removeTab(3) ; // remove relays. Not useful in Tor mode.
ui.tabWidget->removeTab(1) ; // remove IP filters. Not useful in Tor mode.
ui.hiddenServiceTab->removeTab(1) ; // remove the Automatic I2P/BOB tab
ui.hiddenpage_proxyAddress_i2p->hide() ;
ui.hiddenpage_proxyLabel_i2p->hide() ;
ui.hiddenpage_proxyPort_i2p->hide() ;
ui.label_i2p_outgoing->hide() ;
ui.iconlabel_i2p_outgoing->hide() ;
ui.plainTextEdit->hide() ;
ui.hiddenpage_configuration->hide() ;
ui.l_hiddenpage_configuration->hide() ;
ui.hiddenpageInHelpPlainTextEdit->hide() ;
ui.hiddenpage_outHeader->setText(tr("Tor has been automatically configured by Retroshare. You shouldn't need to change anything here.")) ;
ui.hiddenpage_inHeader->setText(tr("Tor has been automatically configured by Retroshare. You shouldn't need to change anything here.")) ;
#endif
ui.filteredIpsTable->setHorizontalHeaderItem(COLUMN_RANGE,new QTableWidgetItem(tr("IP Range"))) ;
ui.filteredIpsTable->setHorizontalHeaderItem(COLUMN_STATUS,new QTableWidgetItem(tr("Status"))) ;
ui.filteredIpsTable->setHorizontalHeaderItem(COLUMN_ORIGIN,new QTableWidgetItem(tr("Origin"))) ;
@ -98,7 +137,7 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
for(std::list<std::string>::const_iterator it(ip_servers.begin());it!=ip_servers.end();++it)
ui.IPServersLV->addItem(QString::fromStdString(*it)) ;
ui.hiddenServiceTab->setTabEnabled(hiddenServiceIncomingTab, false);
ui.hiddenServiceTab->setTabEnabled(TAB_HIDDEN_SERVICE_INCOMING, false);
ui.gbBob->setEnabled(false);
ui.swBobAdvanced->setCurrentIndex(0);
@ -196,7 +235,6 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
QObject::connect(ui.enableCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateRelayMode()));
QObject::connect(ui.serverCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateRelayMode()));
}
void ServerPage::saveAndTestInProxy()
@ -300,8 +338,8 @@ void ServerPage::load()
if (mIsHiddenNode)
{
mHiddenType = detail.hiddenType;
ui.tabWidget->setTabEnabled(1,false) ; // ip filter
ui.tabWidget->setTabEnabled(3,false) ; // relay
ui.tabWidget->setTabEnabled(TAB_IP_FILTERS,false) ; // ip filter
ui.tabWidget->setTabEnabled(TAB_RELAYS,false) ; // relay
loadHiddenNode();
return;
}
@ -460,6 +498,9 @@ void ServerPage::toggleIpFiltering(bool b)
void ServerPage::loadFilteredIps()
{
if(rsBanList == NULL)
return ;
if(rsBanList->ipFilteringEnabled())
{
whileBlocking(ui.denyAll_CB)->setChecked(true) ;
@ -854,6 +895,8 @@ void ServerPage::toggleUPnP()
settingChangeable = true;
}
// Shouldn't we use readOnly instead of enabled??
if (settingChangeable)
{
ui.localAddress->setEnabled(false);
@ -876,7 +919,7 @@ void ServerPage::saveAddresses()
saveCommon();
if(ui.tabWidget->currentIndex() == 2) // hidden services tab
if(ui.tabWidget->currentIndex() == TAB_HIDDEN_SERVICE) // hidden services tab
updateOutProxyIndicator();
if (mIsHiddenNode) {
@ -1055,7 +1098,7 @@ void ServerPage::loadHiddenNode()
ui.label_dynDNS->setVisible(false);
ui.dynDNS ->setVisible(false);
ui.hiddenServiceTab->setTabEnabled(hiddenServiceIncomingTab, true);
ui.hiddenServiceTab->setTabEnabled(TAB_HIDDEN_SERVICE_INCOMING, true);
/* Addresses must be set here - otherwise can't edit it */
/* set local address */

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1220</width>
<height>896</height>
<width>1283</width>
<height>917</height>
</rect>
</property>
<layout class="QVBoxLayout" name="ServerPageVLayout">
@ -26,7 +26,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="tabNetConf">
<attribute name="title">

View file

@ -187,6 +187,10 @@ public:
/** Sets whether the bandwidth graph is always on top. */
void setBWGraphAlwaysOnTop(bool alwaysOnTop);
#ifdef RETROTOR
void setHiddenServiceKey() ;
#endif
uint getNewsFeedFlags();
void setNewsFeedFlags(uint flags);

View file

@ -279,6 +279,7 @@ void DhtWindow::updateNetStatus()
void DhtWindow::updateNetPeers()
{
#ifdef RS_USE_BITDHT
//QTreeWidget *peerTreeWidget = ui.peerTreeWidget;
std::list<RsPeerId> peerIds;
@ -364,7 +365,6 @@ void DhtWindow::updateNetPeers()
QHeaderView * _header = ui.peerTreeWidget->header () ;
_header->resizeSection ( PTW_COL_RSNAME, 170 );
/* update the data */
RsDhtNetPeer status;
rsDht->getNetPeerStatus(*it, status);
@ -518,6 +518,7 @@ void DhtWindow::updateNetPeers()
//peerSummaryLabel->setText(connstr);
#endif
}

View file

@ -0,0 +1,138 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2009 RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "torstatus.h"
#include <QLayout>
#include <QLabel>
#include <QIcon>
#include <QPixmap>
#include "retroshare/rsconfig.h"
#include "util/misc.h"
#ifdef RETROTOR
#include "TorControl/TorManager.h"
#include "TorControl/TorControl.h"
#endif
#include <iomanip>
TorStatus::TorStatus(QWidget *parent)
: QWidget(parent)
{
QHBoxLayout *hbox = new QHBoxLayout();
hbox->setMargin(0);
hbox->setSpacing(6);
statusTor = new QLabel("<strong>" + tr("Tor") + ":</strong>", this );
statusTor->setToolTip(tr("<p>This version of Retroshare uses Tor to connect to your friends.</p>")) ;
hbox->addWidget(statusTor);
torstatusLabel = new QLabel( this );
torstatusLabel->setPixmap(QPixmap(":/icons/no-tor.png"));
hbox->addWidget(torstatusLabel);
_compactMode = false;
setLayout( hbox );
}
void TorStatus::getTorStatus()
{
statusTor->setVisible(!_compactMode);
QString text = _compactMode?statusTor->text():"";
/* check local network state. We cannot make sure that Tor is running yet. */
uint32_t netState = rsConfig -> getNetState();
bool online ;
switch(netState)
{
default:
case RSNET_NETSTATE_BAD_UNKNOWN:
case RSNET_NETSTATE_BAD_OFFLINE: online = false ;
break ;
case RSNET_NETSTATE_WARNING_RESTART:
case RSNET_NETSTATE_BAD_NATSYM:
case RSNET_NETSTATE_BAD_NODHT_NAT:
case RSNET_NETSTATE_WARNING_NATTED:
case RSNET_NETSTATE_WARNING_NODHT:
case RSNET_NETSTATE_GOOD:
case RSNET_NETSTATE_ADV_FORWARD: online = true ;
break ;
}
/* now the extra bit .... switch on check boxes */
int S = QFontMetricsF(torstatusLabel->font()).height();
#ifdef RETROTOR
// get Tor status
int tor_control_status = Tor::TorManager::instance()->control()->status();
int torstatus = Tor::TorManager::instance()->control()->torStatus();
QString tor_control_status_str,torstatus_str ;
bool tor_control_ok ;
switch(tor_control_status)
{
default:
case Tor::TorControl::Error : tor_control_ok = false ; tor_control_status_str = "Error" ; break ;
case Tor::TorControl::NotConnected: tor_control_ok = false ; tor_control_status_str = "Not connected" ; break ;
case Tor::TorControl::Connecting: tor_control_ok = false ; tor_control_status_str = "Connecting" ; break ;
case Tor::TorControl::Authenticating: tor_control_ok = false ; tor_control_status_str = "Authenticating" ; break ;
case Tor::TorControl::Connected: tor_control_ok = true ; tor_control_status_str = "Connected" ; break ;
}
switch(torstatus)
{
default:
case Tor::TorControl::TorUnknown: torstatus_str = "Unknown" ; break ;
case Tor::TorControl::TorOffline: torstatus_str = "Tor offline" ; break ;
case Tor::TorControl::TorReady: torstatus_str = "Tor ready" ; break ;
}
#define MIN_RS_NET_SIZE 10
if(torstatus == Tor::TorControl::TorOffline || !online || !tor_control_ok)
{
// RED - some issue.
torstatusLabel->setPixmap(QPixmap(":/icons/tor-stopping.png").scaledToHeight(1.5*S,Qt::SmoothTransformation));
torstatusLabel->setToolTip( text + tr("Tor is currently offline"));
}
else if(torstatus == Tor::TorControl::TorReady && online && tor_control_ok)
{
torstatusLabel->setPixmap(QPixmap(":/icons/tor-on.png").scaledToHeight(1.5*S,Qt::SmoothTransformation));
torstatusLabel->setToolTip( text + tr("Tor is OK"));
}
else // torstatus == Tor::TorControl::TorUnknown
{
// GRAY.
torstatusLabel->setPixmap(QPixmap(":/icons/no-tor.png").scaledToHeight(1.5*S,Qt::SmoothTransformation));
torstatusLabel->setToolTip( text + tr("No tor configuration"));
}
#else
torstatusLabel->setPixmap(QPixmap(":/icons/tor-stopping.png").scaledToHeight(S,Qt::SmoothTransformation));
torstatusLabel->setToolTip( text + tr("Tor is currently offline"));
#endif
}

View file

@ -0,0 +1,41 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2009 RetroShare Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#pragma once
#include <QWidget>
class QLabel;
class TorStatus : public QWidget
{
Q_OBJECT
public:
TorStatus(QWidget *parent = 0);
void getTorStatus( );
void setCompactMode(bool compact) {_compactMode = compact; }
private:
QLabel *torstatusLabel, *statusTor;
bool _compactMode;
};