mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-21 13:49:04 -04:00
merged with upstream/master
This commit is contained in:
commit
5c2f714ada
756 changed files with 25906 additions and 14932 deletions
|
@ -67,17 +67,17 @@ public:
|
|||
enum Status
|
||||
{
|
||||
Error = -1,
|
||||
NotConnected,
|
||||
Connecting,
|
||||
Authenticating,
|
||||
Connected
|
||||
NotConnected = 0x00,
|
||||
Connecting = 0x01,
|
||||
Authenticating = 0x02,
|
||||
Connected = 0x03
|
||||
};
|
||||
|
||||
enum TorStatus
|
||||
{
|
||||
TorUnknown,
|
||||
TorOffline,
|
||||
TorReady
|
||||
TorUnknown = 0x00,
|
||||
TorOffline = 0x01,
|
||||
TorReady = 0x02
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -118,12 +118,17 @@ TorProcess *TorManager::process()
|
|||
return d->process;
|
||||
}
|
||||
|
||||
QString TorManager::dataDirectory() const
|
||||
bool TorManager::isTorAvailable()
|
||||
{
|
||||
return !instance()->d->torExecutablePath().isNull();
|
||||
}
|
||||
|
||||
QString TorManager::torDataDirectory() const
|
||||
{
|
||||
return d->dataDir;
|
||||
}
|
||||
|
||||
void TorManager::setDataDirectory(const QString &path)
|
||||
void TorManager::setTorDataDirectory(const QString &path)
|
||||
{
|
||||
d->dataDir = QDir::fromNativeSeparators(path);
|
||||
|
||||
|
|
|
@ -58,18 +58,18 @@ class TorManager : public QObject
|
|||
Q_PROPERTY(Tor::TorControl* control READ control CONSTANT)
|
||||
Q_PROPERTY(bool hasError READ hasError NOTIFY errorChanged)
|
||||
Q_PROPERTY(QString errorMessage READ errorMessage NOTIFY errorChanged)
|
||||
Q_PROPERTY(QString dataDirectory READ dataDirectory WRITE setDataDirectory)
|
||||
Q_PROPERTY(QString torDataDirectory READ torDataDirectory WRITE setTorDataDirectory)
|
||||
|
||||
public:
|
||||
|
||||
explicit TorManager(QObject *parent = 0);
|
||||
static bool isTorAvailable() ;
|
||||
static TorManager *instance();
|
||||
|
||||
TorProcess *process();
|
||||
TorControl *control();
|
||||
|
||||
QString dataDirectory() const;
|
||||
void setDataDirectory(const QString &path);
|
||||
|
||||
QString torDataDirectory() const;
|
||||
void setTorDataDirectory(const QString &path);
|
||||
|
||||
QString hiddenServiceDirectory() const;
|
||||
void setHiddenServiceDirectory(const QString &path);
|
||||
|
@ -100,6 +100,7 @@ signals:
|
|||
void errorChanged();
|
||||
|
||||
private:
|
||||
explicit TorManager(QObject *parent = 0);
|
||||
TorManagerPrivate *d;
|
||||
};
|
||||
|
||||
|
|
42
retroshare-gui/src/cmark_export.h
Normal file
42
retroshare-gui/src/cmark_export.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
|
||||
#ifndef CMARK_EXPORT_H
|
||||
#define CMARK_EXPORT_H
|
||||
|
||||
#ifdef CMARK_STATIC_DEFINE
|
||||
# define CMARK_EXPORT
|
||||
# define CMARK_NO_EXPORT
|
||||
#else
|
||||
# ifndef CMARK_EXPORT
|
||||
# ifdef libcmark_EXPORTS
|
||||
/* We are building this library */
|
||||
# define CMARK_EXPORT __attribute__((visibility("default")))
|
||||
# else
|
||||
/* We are using this library */
|
||||
# define CMARK_EXPORT __attribute__((visibility("default")))
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef CMARK_NO_EXPORT
|
||||
# define CMARK_NO_EXPORT __attribute__((visibility("hidden")))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CMARK_DEPRECATED
|
||||
# define CMARK_DEPRECATED __attribute__ ((__deprecated__))
|
||||
#endif
|
||||
|
||||
#ifndef CMARK_DEPRECATED_EXPORT
|
||||
# define CMARK_DEPRECATED_EXPORT CMARK_EXPORT CMARK_DEPRECATED
|
||||
#endif
|
||||
|
||||
#ifndef CMARK_DEPRECATED_NO_EXPORT
|
||||
# define CMARK_DEPRECATED_NO_EXPORT CMARK_NO_EXPORT CMARK_DEPRECATED
|
||||
#endif
|
||||
|
||||
#if 0 /* DEFINE_NO_DEPRECATED */
|
||||
# ifndef CMARK_NO_DEPRECATED
|
||||
# define CMARK_NO_DEPRECATED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif
|
7
retroshare-gui/src/cmark_version.h
Normal file
7
retroshare-gui/src/cmark_version.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#ifndef CMARK_VERSION_H
|
||||
#define CMARK_VERSION_H
|
||||
|
||||
#define CMARK_VERSION ((0 << 16) | (28 << 8) | 0)
|
||||
#define CMARK_VERSION_STRING "0.28.0"
|
||||
|
||||
#endif
|
76
retroshare-gui/src/config.h
Normal file
76
retroshare-gui/src/config.h
Normal file
|
@ -0,0 +1,76 @@
|
|||
#ifndef CMARK_CONFIG_H
|
||||
#define CMARK_CONFIG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define HAVE_STDBOOL_H
|
||||
|
||||
#ifdef HAVE_STDBOOL_H
|
||||
#include <stdbool.h>
|
||||
#elif !defined(__cplusplus)
|
||||
typedef char bool;
|
||||
#endif
|
||||
|
||||
#define HAVE___BUILTIN_EXPECT
|
||||
|
||||
#define HAVE___ATTRIBUTE__
|
||||
|
||||
#ifdef HAVE___ATTRIBUTE__
|
||||
#define CMARK_ATTRIBUTE(list) __attribute__ (list)
|
||||
#else
|
||||
#define CMARK_ATTRIBUTE(list)
|
||||
#endif
|
||||
|
||||
#ifndef CMARK_INLINE
|
||||
#if defined(_MSC_VER) && !defined(__cplusplus)
|
||||
#define CMARK_INLINE __inline
|
||||
#else
|
||||
#define CMARK_INLINE inline
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* snprintf and vsnprintf fallbacks for MSVC before 2015,
|
||||
due to Valentin Milea http://stackoverflow.com/questions/2915672/
|
||||
*/
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#define snprintf c99_snprintf
|
||||
#define vsnprintf c99_vsnprintf
|
||||
|
||||
CMARK_INLINE int c99_vsnprintf(char *outBuf, size_t size, const char *format, va_list ap)
|
||||
{
|
||||
int count = -1;
|
||||
|
||||
if (size != 0)
|
||||
count = _vsnprintf_s(outBuf, size, _TRUNCATE, format, ap);
|
||||
if (count == -1)
|
||||
count = _vscprintf(format, ap);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
CMARK_INLINE int c99_snprintf(char *outBuf, size_t size, const char *format, ...)
|
||||
{
|
||||
int count;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
count = c99_vsnprintf(outBuf, size, format, ap);
|
||||
va_end(ap);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
86
retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.cpp
Normal file
86
retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.cpp
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*******************************************************************************
|
||||
* retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.cpp *
|
||||
* *
|
||||
* Copyright 2018 by Retroshare Team <retroshare.team@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include <QMenu>
|
||||
#include <QDateTime>
|
||||
|
||||
#include "retroshare/rsfiles.h"
|
||||
|
||||
#include "BannedFilesDialog.h"
|
||||
|
||||
#define COLUMN_FILE_NAME 0
|
||||
#define COLUMN_FILE_HASH 1
|
||||
#define COLUMN_FILE_SIZE 2
|
||||
#define COLUMN_FILE_TIME 3
|
||||
|
||||
BannedFilesDialog::BannedFilesDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
fillFilesList() ;
|
||||
|
||||
connect(ui.bannedFiles_TW, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(bannedFilesContextMenu(QPoint)));
|
||||
}
|
||||
|
||||
BannedFilesDialog::~BannedFilesDialog() {}
|
||||
|
||||
void BannedFilesDialog::unbanFile()
|
||||
{
|
||||
int row = ui.bannedFiles_TW->currentRow();
|
||||
|
||||
QTableWidgetItem *item = ui.bannedFiles_TW->item(row, COLUMN_FILE_HASH);
|
||||
|
||||
RsFileHash hash(item->data(Qt::UserRole).toString().toStdString()) ;
|
||||
rsFiles->unbanFile(hash) ;
|
||||
|
||||
fillFilesList();
|
||||
}
|
||||
|
||||
void BannedFilesDialog::bannedFilesContextMenu(QPoint)
|
||||
{
|
||||
QMenu menu(this);
|
||||
|
||||
menu.addAction(QIcon(":/images/FeedAdd.png"), tr("Remove"), this, SLOT(unbanFile()));
|
||||
|
||||
menu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void BannedFilesDialog::fillFilesList()
|
||||
{
|
||||
std::map<RsFileHash,BannedFileEntry> banned_files ;
|
||||
|
||||
rsFiles->getPrimaryBannedFilesList(banned_files);
|
||||
int row=0;
|
||||
|
||||
ui.bannedFiles_TW->setRowCount(banned_files.size()) ;
|
||||
|
||||
for(auto it(banned_files.begin());it!=banned_files.end();++it)
|
||||
{
|
||||
ui.bannedFiles_TW->setItem(row, COLUMN_FILE_NAME, new QTableWidgetItem(QIcon(),QString::fromUtf8(it->second.filename.c_str()),0));
|
||||
ui.bannedFiles_TW->setItem(row, COLUMN_FILE_HASH, new QTableWidgetItem(QIcon(),QString::fromStdString(it->first.toStdString()),0));
|
||||
ui.bannedFiles_TW->setItem(row, COLUMN_FILE_SIZE, new QTableWidgetItem(QIcon(),QString::number(it->second.size),0));
|
||||
ui.bannedFiles_TW->setItem(row, COLUMN_FILE_TIME, new QTableWidgetItem(QIcon(),QDateTime::fromTime_t(it->second.ban_time_stamp).toString(),0));
|
||||
|
||||
ui.bannedFiles_TW->item(row, COLUMN_FILE_HASH)->setData(Qt::UserRole, QString::fromStdString(it->first.toStdString()));
|
||||
|
||||
row++;
|
||||
}
|
||||
}
|
49
retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.h
Normal file
49
retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*******************************************************************************
|
||||
* retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.h *
|
||||
* *
|
||||
* Copyright 2018 by Retroshare Team <retroshare.team@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RsAutoUpdatePage.h"
|
||||
#include "ui_BannedFilesDialog.h"
|
||||
|
||||
class BannedFilesDialog: public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
BannedFilesDialog(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
~BannedFilesDialog();
|
||||
|
||||
private slots:
|
||||
void unbanFile();
|
||||
|
||||
/** management of the adv search dialog object when switching search modes */
|
||||
//void hideEvent(QHideEvent * event);
|
||||
void bannedFilesContextMenu(QPoint);
|
||||
|
||||
private:
|
||||
void fillFilesList();
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::BannedFilesDialog ui;
|
||||
};
|
||||
|
67
retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.ui
Normal file
67
retroshare-gui/src/gui/FileTransfer/BannedFilesDialog.ui
Normal file
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>BannedFilesDialog</class>
|
||||
<widget class="QDialog" name="BannedFilesDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>923</width>
|
||||
<height>810</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-weight:600;">Collaborative file control</span>: the list below contains files you choose to ban from your <span style=" font-weight:600;">local</span> network: you will not forward search results nor data from these files to your friends. This list is securely shared with your friends, unless they uncheck option &quot;Trust my friends for banning unwanted content&quot;. This feature cannot globally hide a file unless a signficant proportion of users in the same network decide to ban it.</p></body></html></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignJustify|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="bannedFiles_TW">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Filename</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Hash</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Size</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Banned since...</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "rshare.h"
|
||||
#include "SearchDialog.h"
|
||||
#include "gui/FileTransfer/BannedFilesDialog.h"
|
||||
#include "gui/RSHumanReadableDelegate.h"
|
||||
#include "gui/RetroShareLink.h"
|
||||
#include "retroshare-gui/RsAutoUpdatePage.h"
|
||||
|
@ -54,6 +55,7 @@
|
|||
#define IMAGE_COLLVIEW ":/images/library_view.png"
|
||||
#define IMAGE_COLLOPEN ":/images/library.png"
|
||||
#define IMAGE_COPYLINK ":/images/copyrslink.png"
|
||||
#define IMAGE_BANFILE ":/icons/biohazard_red.png"
|
||||
|
||||
/* Key for UI Preferences */
|
||||
#define UI_PREF_ADVANCED_SEARCH "UIOptions/AdvancedSearch"
|
||||
|
@ -117,6 +119,7 @@ SearchDialog::SearchDialog(QWidget *parent)
|
|||
connect( ui.searchResultWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( searchResultWidgetCustomPopupMenu( QPoint ) ) );
|
||||
|
||||
connect( ui.searchSummaryWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( searchSummaryWidgetCustomPopupMenu( QPoint ) ) );
|
||||
connect( ui.showBannedFiles_TB, SIGNAL( clicked() ), this, SLOT( openBannedFiles() ) );
|
||||
|
||||
connect( ui.lineEdit, SIGNAL( returnPressed ( void ) ), this, SLOT( searchKeywords( void ) ) );
|
||||
connect( ui.lineEdit, SIGNAL( textChanged ( const QString& ) ), this, SLOT( checkText( const QString& ) ) );
|
||||
|
@ -165,8 +168,10 @@ SearchDialog::SearchDialog(QWidget *parent)
|
|||
QHeaderView_setSectionResizeModeColumn(_smheader, SS_KEYWORDS_COL, QHeaderView::Interactive);
|
||||
QHeaderView_setSectionResizeModeColumn(_smheader, SS_RESULTS_COL, QHeaderView::Interactive);
|
||||
|
||||
_smheader->resizeSection ( SS_KEYWORDS_COL, 160 );
|
||||
_smheader->resizeSection ( SS_RESULTS_COL, 50 );
|
||||
float f = QFontMetricsF(font()).height()/14.0 ;
|
||||
|
||||
_smheader->resizeSection ( SS_KEYWORDS_COL, 160*f );
|
||||
_smheader->resizeSection ( SS_RESULTS_COL, 50*f );
|
||||
|
||||
ui.searchResultWidget->setColumnCount(SR_COL_COUNT);
|
||||
_smheader = ui.searchResultWidget->header () ;
|
||||
|
@ -174,12 +179,12 @@ SearchDialog::SearchDialog(QWidget *parent)
|
|||
QHeaderView_setSectionResizeModeColumn(_smheader, SR_SIZE_COL, QHeaderView::Interactive);
|
||||
QHeaderView_setSectionResizeModeColumn(_smheader, SR_SOURCES_COL, QHeaderView::Interactive);
|
||||
|
||||
_smheader->resizeSection ( SR_NAME_COL, 240 );
|
||||
_smheader->resizeSection ( SR_SIZE_COL, 75 );
|
||||
_smheader->resizeSection ( SR_SOURCES_COL, 75 );
|
||||
_smheader->resizeSection ( SR_TYPE_COL, 75 );
|
||||
_smheader->resizeSection ( SR_AGE_COL, 90 );
|
||||
_smheader->resizeSection ( SR_HASH_COL, 240 );
|
||||
_smheader->resizeSection ( SR_NAME_COL, 240*f );
|
||||
_smheader->resizeSection ( SR_SIZE_COL, 75*f );
|
||||
_smheader->resizeSection ( SR_SOURCES_COL, 75*f );
|
||||
_smheader->resizeSection ( SR_TYPE_COL, 75*f );
|
||||
_smheader->resizeSection ( SR_AGE_COL, 90*f );
|
||||
_smheader->resizeSection ( SR_HASH_COL, 240*f );
|
||||
|
||||
// set header text aligment
|
||||
QTreeWidgetItem * headerItem = ui.searchResultWidget->headerItem();
|
||||
|
@ -201,10 +206,10 @@ SearchDialog::SearchDialog(QWidget *parent)
|
|||
// load settings
|
||||
processSettings(true);
|
||||
|
||||
ui._ownFiles_CB->setMinimumWidth(20);
|
||||
ui._friendListsearch_SB->setMinimumWidth(20);
|
||||
ui._anonF2Fsearch_CB->setMinimumWidth(20);
|
||||
ui.label->setMinimumWidth(20);
|
||||
ui._ownFiles_CB->setMinimumWidth(20*f);
|
||||
ui._friendListsearch_SB->setMinimumWidth(20*f);
|
||||
ui._anonF2Fsearch_CB->setMinimumWidth(20*f);
|
||||
ui.label->setMinimumWidth(20*f);
|
||||
|
||||
// workaround for Qt bug, be solved in next Qt release 4.7.0
|
||||
// https://bugreports.qt-project.org/browse/QTBUG-8270
|
||||
|
@ -325,6 +330,7 @@ void SearchDialog::searchResultWidgetCustomPopupMenu( QPoint /*point*/ )
|
|||
QMenu contextMnu(this) ;
|
||||
|
||||
contextMnu.addAction(QIcon(IMAGE_START), tr("Download"), this, SLOT(download())) ;
|
||||
contextMnu.addAction(QIcon(IMAGE_BANFILE), tr("Mark as bad"), this, SLOT(ban())) ;
|
||||
contextMnu.addSeparator();//--------------------------------------
|
||||
|
||||
contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyResultLink())) ;
|
||||
|
@ -404,22 +410,53 @@ void SearchDialog::download()
|
|||
std::cout << "isuing file request from search dialog: -"
|
||||
<< (item->text(SR_NAME_COL)).toStdString()
|
||||
<< "-" << hash << "-" << (item->text(SR_SIZE_COL)).toULongLong() << "-ids=" ;
|
||||
for(std::list<RsPeerId>::const_iterator it(srcIds.begin()); it!=srcIds.end(); ++it) {
|
||||
for(std::list<RsPeerId>::const_iterator it(srcIds.begin()); it!=srcIds.end(); ++it)
|
||||
std::cout << *it << "-" << std::endl;
|
||||
}//for(std::list<RsPeerId>::const_iterator
|
||||
//QColor foreground = QColor(0, 128, 0); // green
|
||||
|
||||
QColor foreground = textColorDownloading();
|
||||
QBrush brush(foreground);
|
||||
for (int i = 0; i < item->columnCount(); ++i)
|
||||
{
|
||||
item->setForeground(i, brush);
|
||||
}
|
||||
}//if(!rsFiles -> FileRequest(
|
||||
}//if (item->text(SR_HASH_COL).isEmpty())
|
||||
}//for (int i = 0
|
||||
if (attemptDownloadLocal) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (attemptDownloadLocal)
|
||||
QMessageBox::information(this, tr("Download Notice"), tr("Skipping Local Files")) ;
|
||||
}//if (attemptDownloadLocal)
|
||||
}
|
||||
|
||||
void SearchDialog::ban()
|
||||
{
|
||||
/* should also be able to handle multi-selection */
|
||||
|
||||
QList<QTreeWidgetItem*> itemsForDownload = ui.searchResultWidget->selectedItems() ;
|
||||
int numdls = itemsForDownload.size() ;
|
||||
QTreeWidgetItem * item ;
|
||||
|
||||
for (int i = 0; i < numdls; ++i)
|
||||
{
|
||||
item = itemsForDownload.at(i) ;
|
||||
// call the download
|
||||
// *
|
||||
if(!item->text(SR_HASH_COL).isEmpty())
|
||||
{
|
||||
std::cerr << "SearchDialog::download() Calling File Ban" << std::endl ;
|
||||
|
||||
RsFileHash hash( item->text(SR_HASH_COL).toStdString()) ;
|
||||
|
||||
rsFiles -> banFile( hash, (item->text(SR_NAME_COL)).toUtf8().constData() , (item->text(SR_SIZE_COL)).toULongLong());
|
||||
|
||||
while(item->parent() != NULL)
|
||||
item = item->parent();
|
||||
|
||||
ui.searchResultWidget->takeTopLevelItem(ui.searchResultWidget->indexOfTopLevelItem(item)) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SearchDialog::openBannedFiles()
|
||||
{
|
||||
BannedFilesDialog d ;
|
||||
d.exec();
|
||||
}
|
||||
|
||||
void SearchDialog::collCreate()
|
||||
|
@ -792,7 +829,7 @@ void SearchDialog::advancedSearch(RsRegularExpression::Expression* expression)
|
|||
RsRegularExpression::LinearizedExpression e ;
|
||||
expression->linearize(e) ;
|
||||
|
||||
TurtleRequestId req_id = rsTurtle->turtleSearch(e) ;
|
||||
TurtleRequestId req_id = rsFiles->turtleSearch(e) ;
|
||||
|
||||
// This will act before turtle results come to the interface, thanks to the signals scheduling policy.
|
||||
initSearchResult(QString::fromStdString(e.GetStrings()),req_id, ui.FileTypeComboBox->currentIndex(), true) ;
|
||||
|
@ -858,9 +895,9 @@ void SearchDialog::searchKeywords(const QString& keywords)
|
|||
if(ui._anonF2Fsearch_CB->isChecked())
|
||||
{
|
||||
if(n==1)
|
||||
req_id = rsTurtle->turtleSearch(words.front()) ;
|
||||
req_id = rsFiles->turtleSearch(words.front()) ;
|
||||
else
|
||||
req_id = rsTurtle->turtleSearch(lin_exp) ;
|
||||
req_id = rsFiles->turtleSearch(lin_exp) ;
|
||||
}
|
||||
else
|
||||
req_id = RSRandom::random_u32() ; // generate a random 32 bits request id
|
||||
|
@ -940,9 +977,7 @@ void SearchDialog::processResultQueue()
|
|||
while(!searchResultsQueue.empty() && nb_treated_elements++ < 250)
|
||||
{
|
||||
qulonglong search_id = searchResultsQueue.back().first ;
|
||||
FileDetail file = searchResultsQueue.back().second ;
|
||||
|
||||
searchResultsQueue.pop_back() ;
|
||||
FileDetail& file = searchResultsQueue.back().second ;
|
||||
|
||||
#ifdef DEBUG
|
||||
std::cout << "Updating file detail:" << std::endl ;
|
||||
|
@ -952,6 +987,8 @@ void SearchDialog::processResultQueue()
|
|||
#endif
|
||||
|
||||
insertFile(search_id,file);
|
||||
|
||||
searchResultsQueue.pop_back() ;
|
||||
}
|
||||
ui.searchResultWidget->setSortingEnabled(true);
|
||||
if(!searchResultsQueue.empty())
|
||||
|
@ -1286,6 +1323,7 @@ void SearchDialog::insertFile(qulonglong searchId, const FileDetail& file, int s
|
|||
modifiedResult =QString::number(friendSource) + "/" + QString::number(anonymousSource);
|
||||
float fltRes = friendSource + (float)anonymousSource/1000;
|
||||
item->setText(SR_SOURCES_COL,modifiedResult);
|
||||
item->setToolTip(SR_SOURCES_COL, tr("Obtained via ")+QString::fromStdString(rsPeers->getPeerName(file.id)) );
|
||||
item->setData(SR_SOURCES_COL, ROLE_SORT, fltRes);
|
||||
item->setTextAlignment( SR_SOURCES_COL, Qt::AlignRight );
|
||||
item->setText(SR_SEARCH_ID_COL, sid_hexa);
|
||||
|
|
|
@ -75,6 +75,7 @@ private slots:
|
|||
void searchSummaryWidgetCustomPopupMenu( QPoint point );
|
||||
|
||||
void download();
|
||||
void ban();
|
||||
|
||||
void collCreate();
|
||||
void collModif();
|
||||
|
@ -86,6 +87,7 @@ private slots:
|
|||
void recommendtofriends();
|
||||
void checkText(const QString&);
|
||||
|
||||
void openBannedFiles();
|
||||
void copyResultLink();
|
||||
void copySearchLink();
|
||||
void openFolderSearch();
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>758</width>
|
||||
<height>339</height>
|
||||
<width>1531</width>
|
||||
<height>889</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -32,7 +32,16 @@
|
|||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
|
@ -55,15 +64,24 @@
|
|||
</size>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="LineEditClear" name="lineEdit">
|
||||
<property name="toolTip">
|
||||
|
@ -152,6 +170,23 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="showBannedFiles_TB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/biohazard_red.png</normaloff>:/icons/biohazard_red.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -307,7 +342,7 @@
|
|||
<string>Any</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/FileTypeAny.png</normaloff>:/images/FileTypeAny.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
|
@ -316,7 +351,7 @@
|
|||
<string>Archive</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/FileTypeArchive.png</normaloff>:/images/FileTypeArchive.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
|
@ -325,7 +360,7 @@
|
|||
<string>Audio</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/FileTypeAudio.png</normaloff>:/images/FileTypeAudio.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
|
@ -334,7 +369,7 @@
|
|||
<string>CD-Image</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/FileTypeCDImage.png</normaloff>:/images/FileTypeCDImage.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
|
@ -343,7 +378,7 @@
|
|||
<string>Document</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/FileTypeDocument.png</normaloff>:/images/FileTypeDocument.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
|
@ -352,7 +387,7 @@
|
|||
<string>Picture</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/FileTypePicture.png</normaloff>:/images/FileTypePicture.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
|
@ -361,7 +396,7 @@
|
|||
<string>Program</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/FileTypeProgram.png</normaloff>:/images/FileTypeProgram.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
|
@ -370,7 +405,7 @@
|
|||
<string>Video</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/FileTypeVideo.png</normaloff>:/images/FileTypeVideo.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
|
@ -379,7 +414,7 @@
|
|||
<string>Directory</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/folder16.png</normaloff>:/images/folder16.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
|
@ -406,7 +441,7 @@
|
|||
<string>Download selected</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/download16.png</normaloff>:/images/download16.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
|
@ -423,7 +458,7 @@
|
|||
<customwidget>
|
||||
<class>LineEditClear</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>gui/common/LineEditClear.h</header>
|
||||
<header location="global">gui/common/LineEditClear.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>SearchTreeWidget</class>
|
||||
|
@ -432,7 +467,8 @@
|
|||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="images.qrc"/>
|
||||
<include location="../icons.qrc"/>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
|
@ -1140,14 +1140,14 @@ void LocalSharedFilesDialog::spawnCustomPopupMenu( QPoint point )
|
|||
{
|
||||
shareChannelMenu.setIcon(QIcon(IMAGE_CHANNEL));
|
||||
|
||||
std::list<RsGroupMetaData> grp_metas ;
|
||||
std::map<RsGxsGroupId,RsGroupMetaData> grp_metas ;
|
||||
channelDialog->getGroupList(grp_metas) ;
|
||||
|
||||
std::vector<std::pair<std::string,RsGxsGroupId> > grplist ; // I dont use a std::map because two or more channels may have the same name.
|
||||
|
||||
for(auto it(grp_metas.begin());it!=grp_metas.end();++it)
|
||||
if(IS_GROUP_PUBLISHER((*it).mSubscribeFlags) && IS_GROUP_SUBSCRIBED((*it).mSubscribeFlags))
|
||||
grplist.push_back(std::make_pair((*it).mGroupName, (*it).mGroupId));
|
||||
if(IS_GROUP_PUBLISHER((*it).second.mSubscribeFlags) && IS_GROUP_SUBSCRIBED((*it).second.mSubscribeFlags))
|
||||
grplist.push_back(std::make_pair((*it).second.mGroupName, (*it).second.mGroupId));
|
||||
|
||||
std::sort(grplist.begin(),grplist.end(),ChannelCompare()) ;
|
||||
|
||||
|
@ -1164,14 +1164,14 @@ void LocalSharedFilesDialog::spawnCustomPopupMenu( QPoint point )
|
|||
{
|
||||
shareForumMenu.setIcon(QIcon(IMAGE_FORUMS));
|
||||
|
||||
std::list<RsGroupMetaData> grp_metas ;
|
||||
std::map<RsGxsGroupId,RsGroupMetaData> grp_metas ;
|
||||
forumsDialog->getGroupList(grp_metas) ;
|
||||
|
||||
std::vector<std::pair<std::string,RsGxsGroupId> > grplist ; // I dont use a std::map because two or more channels may have the same name.
|
||||
|
||||
for(auto it(grp_metas.begin());it!=grp_metas.end();++it)
|
||||
if(IS_GROUP_SUBSCRIBED((*it).mSubscribeFlags))
|
||||
grplist.push_back(std::make_pair((*it).mGroupName, (*it).mGroupId));
|
||||
if(IS_GROUP_SUBSCRIBED((*it).second.mSubscribeFlags))
|
||||
grplist.push_back(std::make_pair((*it).second.mGroupName, (*it).second.mGroupId));
|
||||
|
||||
std::sort(grplist.begin(),grplist.end(),ChannelCompare()) ;
|
||||
|
||||
|
|
|
@ -55,7 +55,8 @@ public:
|
|||
/* Fixed numbers for load and save the last page */
|
||||
SearchTab = 0, /** Network page. */
|
||||
LocalSharedFilesTab = 1, /** Network new graph. */
|
||||
RemoteSharedFilesTab = 2 /** Old group chat page. */
|
||||
RemoteSharedFilesTab = 2, /** Old group chat page. */
|
||||
DownloadTab = 3
|
||||
};
|
||||
|
||||
|
||||
|
@ -108,9 +109,6 @@ private slots:
|
|||
void expandAllUL();
|
||||
void collapseAllUL();
|
||||
|
||||
// void rootdecorated();
|
||||
// void rootisnotdecorated();
|
||||
|
||||
void pauseFileTransfer();
|
||||
void resumeFileTransfer();
|
||||
void dlOpenFolder();
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include <rshare.h>
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "TorControl/TorManager.h"
|
||||
#include "util/misc.h"
|
||||
|
||||
#include <retroshare/rsidentity.h>
|
||||
|
@ -136,7 +137,7 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent)
|
|||
//ui.headerFrame->setHeaderText(tr("Create a new profile"));
|
||||
|
||||
connect(ui.reuse_existing_node_CB, SIGNAL(triggered()), this, SLOT(switchReuseExistingNode()));
|
||||
connect(ui.adv_checkbox, SIGNAL(triggered()), this, SLOT(setupState()));
|
||||
connect(ui.adv_checkbox, SIGNAL(toggled(bool)), this, SLOT(setupState()));
|
||||
connect(ui.nodeType_CB, SIGNAL(currentIndexChanged(int)), this, SLOT(setupState()));
|
||||
|
||||
connect(ui.genButton, SIGNAL(clicked()), this, SLOT(genPerson()));
|
||||
|
@ -181,10 +182,10 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent)
|
|||
* mark last one as default.
|
||||
*/
|
||||
|
||||
QMenu *menu = new QMenu(tr("Advanced options"));
|
||||
menu->addAction(ui.adv_checkbox);
|
||||
menu->addAction(ui.reuse_existing_node_CB);
|
||||
ui.optionsButton->setMenu(menu);
|
||||
//QMenu *menu = new QMenu(tr("Advanced options"));
|
||||
//menu->addAction(ui.adv_checkbox);
|
||||
//menu->addAction(ui.reuse_existing_node_CB);
|
||||
// ui.optionsButton->setMenu(menu);
|
||||
|
||||
mAllFieldsOk = false ;
|
||||
mEntropyOk = false ;
|
||||
|
@ -195,10 +196,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
|
||||
//#ifdef RETROTOR
|
||||
// ui.adv_checkbox->setChecked(false);
|
||||
// ui.adv_checkbox->setVisible(true);
|
||||
//#endif
|
||||
|
||||
initKeyList();
|
||||
setupState();
|
||||
|
@ -259,30 +260,39 @@ 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(retrotor?1:0) ;
|
||||
ui.keylength_comboBox->setCurrentIndex(0) ;
|
||||
// ui.nodeType_CB->setCurrentIndex(0);
|
||||
}
|
||||
bool hidden_state = ui.nodeType_CB->currentIndex()==1;
|
||||
ui.reuse_existing_node_CB->setVisible(adv_state) ;
|
||||
|
||||
// ui.nodeType_CB->setVisible(adv_state) ;
|
||||
// ui.nodeType_LB->setVisible(adv_state) ;
|
||||
// ui.nodeTypeExplanation_TE->setVisible(adv_state) ;
|
||||
|
||||
bool hidden_state = ui.nodeType_CB->currentIndex()==1 || ui.nodeType_CB->currentIndex()==2;
|
||||
bool generate_new = !ui.reuse_existing_node_CB->isChecked();
|
||||
bool tor_auto = ui.nodeType_CB->currentIndex()==1;
|
||||
|
||||
genNewGPGKey = generate_new;
|
||||
|
||||
switch(ui.nodeType_CB->currentIndex())
|
||||
{
|
||||
case 0: ui.nodeTypeExplanation_TE->setText(tr("<b>Your IP is visible to trusted nodes only. You can also connect to hidden nodes if running Tor on your machine. Best choice for sharing with trusted friends.</b>"));
|
||||
break;
|
||||
case 1: ui.nodeTypeExplanation_TE->setText(tr("<b>Your IP is hidden. All traffic happens over the Tor network. Best choice if you cannot trust friend nodes with your own IP.</b>"));
|
||||
break;
|
||||
case 2: ui.nodeTypeExplanation_TE->setText(tr("<b>Hidden node for advanced users only. Allows to use other proxy solutions such as I2P.</b>"));
|
||||
break;
|
||||
}
|
||||
|
||||
//ui.no_node_label->setVisible(false);
|
||||
|
||||
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 && !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) ;
|
||||
|
@ -318,13 +328,13 @@ void GenCertDialog::setupState()
|
|||
ui.entropy_bar->setVisible(true);
|
||||
ui.genButton->setVisible(true);
|
||||
|
||||
ui.hiddenaddr_input->setVisible(hidden_state && !retrotor);
|
||||
ui.hiddenaddr_label->setVisible(hidden_state && !retrotor);
|
||||
ui.hiddenaddr_input->setVisible(hidden_state && !tor_auto);
|
||||
ui.hiddenaddr_label->setVisible(hidden_state && !tor_auto);
|
||||
|
||||
ui.hiddenport_label->setVisible(hidden_state && !retrotor);
|
||||
ui.hiddenport_spinBox->setVisible(hidden_state && !retrotor);
|
||||
ui.hiddenport_label->setVisible(hidden_state && !tor_auto);
|
||||
ui.hiddenport_spinBox->setVisible(hidden_state && !tor_auto);
|
||||
|
||||
ui.cbUseBob->setVisible(hidden_state && !retrotor);
|
||||
ui.cbUseBob->setVisible(hidden_state && !tor_auto);
|
||||
|
||||
if(!mAllFieldsOk)
|
||||
{
|
||||
|
@ -470,7 +480,6 @@ void GenCertDialog::genPerson()
|
|||
/* Check the data from the GUI. */
|
||||
std::string genLoc = ui.node_input->text().toUtf8().constData();
|
||||
RsPgpId PGPId;
|
||||
bool isHiddenLoc = false;
|
||||
|
||||
if(ui.nickname_input->isVisible())
|
||||
{
|
||||
|
@ -503,18 +512,26 @@ void GenCertDialog::genPerson()
|
|||
}
|
||||
}
|
||||
|
||||
if (ui.nodeType_CB->currentIndex()==1)
|
||||
bool isHiddenLoc = (ui.nodeType_CB->currentIndex()>0);
|
||||
bool isAutoTor = (ui.nodeType_CB->currentIndex()==1);
|
||||
|
||||
if(isAutoTor && !Tor::TorManager::isTorAvailable())
|
||||
{
|
||||
QMessageBox::critical(this,tr("Tor is not available"),tr("No Tor executable has been found on your system. You need to install Tor before creating a hidden identity.")) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
if(isHiddenLoc)
|
||||
{
|
||||
std::string hl = ui.hiddenaddr_input->text().toStdString();
|
||||
uint16_t port = ui.hiddenport_spinBox->value();
|
||||
|
||||
bool useBob = ui.cbUseBob->isChecked();
|
||||
|
||||
if (useBob && hl.empty())
|
||||
hl = "127.0.0.1";
|
||||
|
||||
RsInit::SetHiddenLocation(hl, port, useBob); /* parses it */
|
||||
|
||||
isHiddenLoc = true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -620,7 +637,7 @@ void GenCertDialog::genPerson()
|
|||
std::string err;
|
||||
this->hide();//To show dialog asking password PGP Key.
|
||||
std::cout << "RsAccounts::GenerateSSLCertificate" << std::endl;
|
||||
bool okGen = RsAccounts::GenerateSSLCertificate(PGPId, "", genLoc, "", isHiddenLoc, sslPasswd, sslId, err);
|
||||
bool okGen = RsAccounts::createNewAccount(PGPId, "", genLoc, "", isHiddenLoc, isAutoTor, sslPasswd, sslId, err);
|
||||
|
||||
if (okGen)
|
||||
{
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>569</width>
|
||||
<height>426</height>
|
||||
<width>978</width>
|
||||
<height>826</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -50,10 +50,7 @@
|
|||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="profileframeVLayout">
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="RSLabel">
|
||||
<property name="text">
|
||||
|
@ -71,7 +68,45 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="toolBarHLayout">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="nodeType_LB">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Node type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="nodeType_CB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Standard node</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Hidden node (over Tor)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Hidden node (Tor/I2P - Manually configured)</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="toolBarHSpacer">
|
||||
<property name="orientation">
|
||||
|
@ -86,13 +121,9 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="optionsButton">
|
||||
<widget class="QCheckBox" name="adv_checkbox">
|
||||
<property name="text">
|
||||
<string>Options</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<normaloff>:/icons/svg/options.svg</normaloff>:/icons/svg/options.svg</iconset>
|
||||
<string>advanced options</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
|
@ -100,16 +131,23 @@
|
|||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="nodeTypeExplanation_TE">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="profile_groupBox">
|
||||
<property name="styleSheet">
|
||||
|
@ -233,26 +271,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="2">
|
||||
<widget class="QComboBox" name="nodeType_CB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Standard node</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>TOR/I2P Hidden node</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QLineEdit" name="node_input">
|
||||
<property name="sizePolicy">
|
||||
|
@ -357,6 +375,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="reuse_existing_node_CB">
|
||||
<property name="text">
|
||||
<string>Use existing profile...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="8" column="3">
|
||||
|
@ -675,28 +700,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="1">
|
||||
<widget class="QLabel" name="label_nodeType">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="icons.qrc">:/icons/svg/netgraph.svg</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
|
@ -729,22 +732,6 @@
|
|||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<action name="adv_checkbox">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Advanced options</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="reuse_existing_node_CB">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use existing profile</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>name_input</tabstop>
|
||||
|
|
|
@ -84,12 +84,13 @@
|
|||
#include "statusbar/ToasterDisable.h"
|
||||
#include "statusbar/SysTrayStatus.h"
|
||||
#include "statusbar/torstatus.h"
|
||||
#include <retroshare/rsstatus.h>
|
||||
|
||||
#include <retroshare/rsiface.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsfiles.h>
|
||||
#include <retroshare/rsnotify.h>
|
||||
#include "retroshare/rsstatus.h"
|
||||
#include "retroshare/rsiface.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "retroshare/rsfiles.h"
|
||||
#include "retroshare/rsnotify.h"
|
||||
#include "retroshare/rsinit.h"
|
||||
|
||||
#include "gui/gxschannels/GxsChannelDialog.h"
|
||||
#include "gui/gxsforums/GxsForumsDialog.h"
|
||||
|
@ -250,14 +251,15 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
|
|||
|
||||
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
|
||||
if(RsAccounts::isHiddenNode())
|
||||
{
|
||||
torstatus = new TorStatus();
|
||||
torstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowTor", QVariant(true)).toBool());
|
||||
statusBar()->addWidget(torstatus);
|
||||
torstatus->getTorStatus();
|
||||
}
|
||||
else
|
||||
torstatus = NULL ;
|
||||
|
||||
natstatus = NULL ;
|
||||
dhtstatus = NULL ;
|
||||
|
@ -433,7 +435,7 @@ void MainWindow::initStackedPage()
|
|||
|
||||
#ifndef RS_RELEASE_VERSION
|
||||
#ifdef PLUGINMGR
|
||||
addPage(pluginsPage = new PluginsPage(ui->stackPages), grp, NULL);
|
||||
addPage(pluginsPage = new gui::PluginsPage(ui->stackPages), grp, NULL);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -643,10 +645,10 @@ const QList<UserNotify*> &MainWindow::getUserNotifyList()
|
|||
|
||||
/*static*/ void MainWindow::displayLobbySystrayMsg(const QString& title,const QString& msg)
|
||||
{
|
||||
if (_instance == NULL)
|
||||
if (_instance == NULL)
|
||||
return;
|
||||
|
||||
if(Settings->getDisplayTrayChatLobby())
|
||||
if(Settings->getDisplayTrayChatLobby())
|
||||
_instance->displaySystrayMsg(title,msg) ;
|
||||
}
|
||||
|
||||
|
@ -1011,7 +1013,7 @@ void SetForegroundWindowInternal(HWND hWnd)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
switch (page)
|
||||
switch (page)
|
||||
{
|
||||
case Network:
|
||||
return _instance->friendsDialog->networkDialog;
|
||||
|
@ -1457,7 +1459,7 @@ void MainWindow::externalLinkActivated(const QUrl &url)
|
|||
|
||||
int res = mb.exec() ;
|
||||
|
||||
if (res == QMessageBox::No)
|
||||
if (res == QMessageBox::No)
|
||||
return ;
|
||||
|
||||
if(dontAsk_CB->isChecked())
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
#include "gui/elastic/node.h"
|
||||
#include "gui/elastic/elnode.h"
|
||||
|
||||
/********
|
||||
* #define DEBUG_NETWORKVIEW
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*
|
||||
* 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,
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
|
@ -39,6 +39,8 @@ class QScriptEngine;
|
|||
|
||||
class PluginManager;
|
||||
|
||||
namespace gui {
|
||||
|
||||
|
||||
//! A demo widget for showing plugin engine in action :)
|
||||
|
||||
|
@ -46,7 +48,7 @@ class PluginManager;
|
|||
//! loaded plugin widgets. All specific actions moved to
|
||||
//! PluginManagerWidget class. It contains a PluginManager instance, but it's
|
||||
//! supposed that in future a pluginManager will become a global variable
|
||||
class PluginsPage : public MainPage
|
||||
class PluginsPage : public MainPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -70,10 +72,10 @@ protected:
|
|||
QVBoxLayout* pluginPageLayout;
|
||||
QGroupBox* pluginPanel;
|
||||
QVBoxLayout* pluginPanelLayout;
|
||||
|
||||
|
||||
//! Plugin widgets will be loaded into this tabs
|
||||
QTabWidget* pluginTabs ;
|
||||
|
||||
|
||||
QVBoxLayout* pmLay;
|
||||
QFrame* pmFrame;
|
||||
QSpacerItem* pmSpacer;
|
||||
|
@ -82,5 +84,7 @@ protected:
|
|||
PluginManager* pluginManager;
|
||||
};
|
||||
|
||||
} // namespace gui
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -454,6 +454,10 @@ void PostedListWidget::applyRanking()
|
|||
ui->scrollAreaWidgetContents->update();
|
||||
}
|
||||
|
||||
void PostedListWidget::blank()
|
||||
{
|
||||
clearPosts();
|
||||
}
|
||||
void PostedListWidget::clearPosts()
|
||||
{
|
||||
/* clear all messages */
|
||||
|
|
|
@ -63,6 +63,7 @@ protected:
|
|||
virtual void insertAllPosts(const uint32_t &token, GxsMessageFramePostThread *thread);
|
||||
virtual void insertPosts(const uint32_t &token);
|
||||
virtual void clearPosts();
|
||||
virtual void blank();
|
||||
virtual bool navigatePostItem(const RsGxsMessageId& msgId);
|
||||
|
||||
/* GxsMessageFrameWidget */
|
||||
|
|
|
@ -860,17 +860,17 @@ QString RetroShareLink::title() const
|
|||
break;
|
||||
|
||||
case TYPE_FILE:
|
||||
return QString("%1 (%2)").arg(hash()).arg(misc::friendlyUnit(size()));
|
||||
return QString("Size: %2 hash: %1").arg(hash()).arg(misc::friendlyUnit(size()));
|
||||
|
||||
case TYPE_PERSON:
|
||||
return PeerDefs::rsidFromId(RsPgpId(hash().toStdString()));
|
||||
|
||||
case TYPE_FORUM:
|
||||
/* fallthrough */
|
||||
return QString("Forum id: %1").arg(hash());
|
||||
case TYPE_CHANNEL:
|
||||
/* fallthrough */
|
||||
return QString("Channel id: %1").arg(hash());
|
||||
case TYPE_SEARCH:
|
||||
break;
|
||||
return QString("Search files");
|
||||
|
||||
case TYPE_MESSAGE:
|
||||
return PeerDefs::rsidFromId(RsPeerId(hash().toStdString()));
|
||||
|
@ -1386,13 +1386,6 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
|||
++countUnknown;
|
||||
break;
|
||||
|
||||
case TYPE_FILE:
|
||||
{
|
||||
col.merge_in(link.name(),link.size(),RsFileHash(link.hash().toStdString())) ;
|
||||
fileLinkFound = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_PERSON:
|
||||
{
|
||||
#ifdef DEBUG_RSLINK
|
||||
|
@ -1547,6 +1540,22 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
|||
}
|
||||
break ;
|
||||
|
||||
case TYPE_FILE:
|
||||
{
|
||||
FileInfo fi1;
|
||||
if(links.size()==1 && rsFiles->alreadyHaveFile(RsFileHash(link.hash().toStdString()), fi1)
|
||||
&& !link.name().endsWith(RsCollection::ExtensionString))
|
||||
{
|
||||
/* fallthrough */
|
||||
}
|
||||
else
|
||||
{
|
||||
col.merge_in(link.name(),link.size(),RsFileHash(link.hash().toStdString())) ;
|
||||
fileLinkFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//break;
|
||||
case TYPE_EXTRAFILE:
|
||||
{
|
||||
#ifdef DEBUG_RSLINK
|
||||
|
@ -1621,14 +1630,14 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
|||
} else if (ret == QMessageBox::NoToAll) {
|
||||
dontOpenNextFile = true;
|
||||
}
|
||||
needNotifySuccess = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (rsFiles->FileRequest(cleanname.toUtf8().constData(), RsFileHash(link.hash().toStdString()), link.size(), "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds)) {
|
||||
fileAdded.append(link.name());
|
||||
} else {
|
||||
if (!bFileOpened) fileExist.append(link.name());
|
||||
}
|
||||
if (!bFileOpened && links.size()>1) fileExist.append(link.name());}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ SoundManager::SoundManager() : QObject()
|
|||
|
||||
void SoundManager::soundEvents(SoundEvents &events)
|
||||
{
|
||||
QDir baseDir = QDir(QString::fromUtf8(RsAccounts::DataDirectory().c_str()) + "/sounds");
|
||||
QDir baseDir = QDir(QString::fromUtf8(RsAccounts::systemDataDirectory().c_str()) + "/sounds");
|
||||
|
||||
events.mDefaultPath = baseDir.absolutePath();
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "gui/FriendsDialog.h"
|
||||
#include "gui/MainWindow.h"
|
||||
#include "gui/chat/ChatWidget.h"
|
||||
#include "gui/common/html.h"
|
||||
#include "gui/common/rshtml.h"
|
||||
#include "gui/common/FriendSelectionDialog.h"
|
||||
#include "gui/common/RSTreeWidgetItem.h"
|
||||
#include "gui/gxs/GxsIdChooser.h"
|
||||
|
|
|
@ -149,7 +149,7 @@ static QStringList getBaseDirList()
|
|||
// Search chat styles in config dir and data dir (is application dir for portable)
|
||||
QStringList baseDirs;
|
||||
baseDirs.append(QString::fromUtf8(RsAccounts::ConfigDirectory().c_str()));
|
||||
baseDirs.append(QString::fromUtf8(RsAccounts::DataDirectory().c_str()));
|
||||
baseDirs.append(QString::fromUtf8(RsAccounts::systemDataDirectory().c_str()));
|
||||
|
||||
return baseDirs;
|
||||
}
|
||||
|
|
|
@ -72,8 +72,15 @@
|
|||
* #define CHAT_DEBUG 1
|
||||
*****/
|
||||
|
||||
ChatWidget::ChatWidget(QWidget *parent) :
|
||||
QWidget(parent), sendingBlocked(false), ui(new Ui::ChatWidget)
|
||||
ChatWidget::ChatWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, completionPosition(0), newMessages(false), typing(false), peerStatus(0)
|
||||
, sendingBlocked(false), useCMark(false)
|
||||
, lastStatusSendTime(0)
|
||||
, firstShow(true), inChatCharFormatChanged(false), firstSearch(true)
|
||||
, lastUpdateCursorPos(0), lastUpdateCursorEnd(0)
|
||||
, completer(NULL), notify(NULL)
|
||||
, ui(new Ui::ChatWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -84,17 +91,8 @@ ChatWidget::ChatWidget(QWidget *parent) :
|
|||
int butt_size(iconSize.height() + fmm);
|
||||
QSize buttonSize = QSize(butt_size, butt_size);
|
||||
|
||||
newMessages = false;
|
||||
typing = false;
|
||||
peerStatus = 0;
|
||||
firstShow = true;
|
||||
firstSearch = true;
|
||||
inChatCharFormatChanged = false;
|
||||
completer = NULL;
|
||||
lastMsgDate = QDate::currentDate();
|
||||
|
||||
lastStatusSendTime = 0 ;
|
||||
|
||||
//Resize Tool buttons
|
||||
ui->emoteiconButton->setFixedSize(buttonSize);
|
||||
ui->emoteiconButton->setIconSize(iconSize);
|
||||
|
@ -144,7 +142,6 @@ ChatWidget::ChatWidget(QWidget *parent) :
|
|||
connect(ui->actionSearchWithoutLimit, SIGNAL(triggered()), this, SLOT(toogle_SeachWithoutLimit()));
|
||||
connect(ui->searchButton, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuSearchButton(QPoint)));
|
||||
|
||||
notify=NULL;
|
||||
ui->notifyButton->setVisible(false);
|
||||
|
||||
ui->markButton->setToolTip(tr("<b>Mark this selected text</b><br><i>Ctrl+M</i>"));
|
||||
|
@ -194,6 +191,9 @@ ChatWidget::ChatWidget(QWidget *parent) :
|
|||
fontmenu->addAction(ui->actionResetFont);
|
||||
fontmenu->addAction(ui->actionNoEmbed);
|
||||
fontmenu->addAction(ui->actionSendAsPlainText);
|
||||
#ifdef USE_CMARK
|
||||
fontmenu->addAction(ui->actionSend_as_CommonMark);
|
||||
#endif
|
||||
|
||||
QMenu *menu = new QMenu();
|
||||
menu->addAction(ui->actionClearChatHistory);
|
||||
|
@ -207,6 +207,12 @@ ChatWidget::ChatWidget(QWidget *parent) :
|
|||
ui->chatTextEdit->setOnlyPlainText(ui->actionSendAsPlainText->isChecked());
|
||||
connect(ui->actionSendAsPlainText, SIGNAL(toggled(bool)), ui->chatTextEdit, SLOT(setOnlyPlainText(bool)) );
|
||||
|
||||
#ifdef USE_CMARK
|
||||
connect(ui->actionSend_as_CommonMark, SIGNAL(toggled(bool)), this, SLOT(setUseCMark(bool)) );
|
||||
connect(ui->chatTextEdit, SIGNAL(textChanged()), this, SLOT(updateCMPreview()) );
|
||||
#endif
|
||||
ui->cmPreview->setVisible(false);
|
||||
|
||||
ui->textBrowser->resetImagesStatus(Settings->getChatLoadEmbeddedImages());
|
||||
ui->textBrowser->installEventFilter(this);
|
||||
ui->textBrowser->viewport()->installEventFilter(this);
|
||||
|
@ -981,6 +987,13 @@ void ChatWidget::addChatMsg(bool incoming, const QString &name, const RsGxsId gx
|
|||
formatTextFlag |= RSHTML_FORMATTEXT_EMBED_SMILEYS;
|
||||
}
|
||||
|
||||
#ifdef USE_CMARK
|
||||
//Use CommonMark
|
||||
if (message.contains("CMark=\"true\"")) {
|
||||
formatTextFlag |= RSHTML_FORMATTEXT_USE_CMARK;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Always fix colors
|
||||
formatTextFlag |= RSHTML_FORMATTEXT_FIX_COLORS;
|
||||
qreal desiredContrast = Settings->valueFromGroup("Chat", "MinimumContrast", 4.5).toDouble();
|
||||
|
@ -1229,7 +1242,9 @@ void ChatWidget::sendChat()
|
|||
text = chatWidget->toPlainText();
|
||||
text.replace(QChar(-4),"");//Char used when image on text.
|
||||
} else {
|
||||
RsHtml::optimizeHtml(chatWidget, text, (ui->actionNoEmbed->isChecked() ? RSHTML_FORMATTEXT_NO_EMBED : 0));
|
||||
RsHtml::optimizeHtml(chatWidget, text,
|
||||
(ui->actionNoEmbed->isChecked() ? RSHTML_FORMATTEXT_NO_EMBED : 0)
|
||||
+ (ui->actionSend_as_CommonMark->isChecked() ? RSHTML_FORMATTEXT_USE_CMARK : 0) );
|
||||
}
|
||||
std::string msg = text.toUtf8().constData();
|
||||
|
||||
|
@ -1823,6 +1838,22 @@ bool ChatWidget::setStyle()
|
|||
return false;
|
||||
}
|
||||
|
||||
void ChatWidget::setUseCMark(const bool bUseCMark)
|
||||
{
|
||||
useCMark = bUseCMark;
|
||||
ui->cmPreview->setVisible(useCMark);
|
||||
updateCMPreview();
|
||||
}
|
||||
|
||||
void ChatWidget::updateCMPreview()
|
||||
{
|
||||
if (!useCMark) return;
|
||||
|
||||
QString message = ui->chatTextEdit->toHtml();
|
||||
QString formattedMessage = RsHtml().formatText(ui->cmPreview->document(), message, RSHTML_FORMATTEXT_USE_CMARK);
|
||||
ui->cmPreview->setHtml(formattedMessage);
|
||||
}
|
||||
|
||||
void ChatWidget::quote()
|
||||
{
|
||||
QString text = ui->textBrowser->textCursor().selection().toPlainText();
|
||||
|
|
|
@ -128,6 +128,8 @@ public:
|
|||
|
||||
public slots:
|
||||
void updateStatus(const QString &peer_id, int status);
|
||||
void setUseCMark(const bool bUseCMark);
|
||||
void updateCMPreview();
|
||||
|
||||
private slots:
|
||||
//void pasteCreateMsgLink() ;
|
||||
|
@ -222,7 +224,8 @@ private:
|
|||
bool typing;
|
||||
int peerStatus;
|
||||
|
||||
bool sendingBlocked;
|
||||
bool sendingBlocked;
|
||||
bool useCMark;
|
||||
|
||||
time_t lastStatusSendTime;
|
||||
|
||||
|
|
|
@ -268,22 +268,34 @@ border-image: url(:/images/closepressed.png)
|
|||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="MimeTextEdit" name="chatTextEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<widget class="QSplitter" name="chatTextEditHSplitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
<property name="handleWidth">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="placeholderText" stdset="0">
|
||||
<string>Type a message here</string>
|
||||
<property name="childrenCollapsible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="MimeTextEdit" name="chatTextEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="placeholderText" stdset="0">
|
||||
<string>Type a message here</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="RSTextBrowser" name="cmPreview"/>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -915,6 +927,21 @@ border-image: url(:/images/closepressed.png)
|
|||
<string>Show Hidden Images</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSend_as_CommonMark">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/png/markdown-mark.png</normaloff>:/icons/png/markdown-mark.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Send as CommonMark</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Text will be formatted using CommonMark.</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
@ -945,8 +972,8 @@ border-image: url(:/images/closepressed.png)
|
|||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../icons.qrc"/>
|
||||
<include location="../images.qrc"/>
|
||||
<include location="../icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
|
@ -106,7 +106,7 @@ void CreateLobbyDialog::checkTextFields()
|
|||
break ;
|
||||
}
|
||||
|
||||
RsIdentityDetails(idd) ;
|
||||
RsIdentityDetails idd;
|
||||
|
||||
rsIdentity->getIdDetails(id,idd) ;
|
||||
|
||||
|
|
|
@ -11,17 +11,26 @@
|
|||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Create Chat Lobby</string>
|
||||
<string>Create Chat Room</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/logo/logo_32.png</normaloff>:/images/logo/logo_32.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<layout class="QVBoxLayout" name="CreateLobbyDialogVLayout">
|
||||
<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>
|
||||
|
@ -29,11 +38,11 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<layout class="QVBoxLayout" name="frameVLayout">
|
||||
<item>
|
||||
<widget class="StyledLabel" name="lobbyInfoLabel">
|
||||
<property name="text">
|
||||
<string>A chat lobby is a decentralized and anonymous chat group. All participants receive all messages. Once the lobby is created you can invite other friends from the Friends tab.</string>
|
||||
<string>A chat room is a decentralized and anonymous chat group. All participants receive all messages. Once the room is created you can invite other friend nodes with invite button on top right.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
|
@ -41,16 +50,16 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<layout class="QHBoxLayout" name="mainHLayout">
|
||||
<item>
|
||||
<widget class="QFrame" name="lobbyFrame">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<widget class="QFrame" name="roomFrame">
|
||||
<layout class="QVBoxLayout" name="roomFrameVLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<layout class="QGridLayout" name="roomGLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<widget class="QLabel" name="lobbyName_Lb">
|
||||
<property name="text">
|
||||
<string>Lobby name:</string>
|
||||
<string>Room name:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
|
@ -61,9 +70,9 @@
|
|||
<widget class="QLineEdit" name="lobbyName_LE"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<widget class="QLabel" name="lobbyTopic_Lb">
|
||||
<property name="text">
|
||||
<string>Lobby topic:</string>
|
||||
<string>Room topic:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
|
@ -74,7 +83,7 @@
|
|||
<widget class="QLineEdit" name="lobbyTopic_LE"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<widget class="QLabel" name="idChooser_Lb">
|
||||
<property name="text">
|
||||
<string>Identity to use:</string>
|
||||
</property>
|
||||
|
@ -84,7 +93,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<widget class="QLabel" name="security_Lb">
|
||||
<property name="text">
|
||||
<string>Visibility:</string>
|
||||
</property>
|
||||
|
@ -113,7 +122,7 @@
|
|||
<item row="4" column="2">
|
||||
<widget class="QCheckBox" name="pgp_signed_CB">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>If you check this, only PGP-signed ids can be used to join and talk in this lobby. This limitation prevents anonymous spamming as it becomes possible for at least some people in the lobby to locate the spammer's node.</p></body></html></string>
|
||||
<string><html><head/><body><p>If you check this, only PGP-signed ids can be used to join and talk in this room. This limitation prevents anonymous spamming as it becomes possible for at least some people in the room to locate the spammer's node.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>require PGP-signed identities</string>
|
||||
|
@ -121,7 +130,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QLabel" name="pgp_signed_Lb">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
|
@ -136,7 +145,7 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<spacer name="roomVSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
|
@ -152,34 +161,37 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<layout class="QGridLayout" name="friendListGLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<widget class="QLabel" name="friendListLabel">
|
||||
<property name="text">
|
||||
<string>Select the Friends with which you want to group chat.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QDockWidget" name="contactsdockWidget">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="FriendSelectionWidget" name="keyShareList" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
<verstretch>4</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>52487</width>
|
||||
<height>524287</height>
|
||||
<width>1677215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>220</width>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
|
@ -189,59 +201,6 @@
|
|||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="floating">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="features">
|
||||
<set>QDockWidget::NoDockWidgetFeatures</set>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Invited friends</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents">
|
||||
<layout class="QGridLayout" name="_2">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="FriendSelectionWidget" name="keyShareList" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>4</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>1677215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -249,7 +208,7 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QHBoxLayout" name="toolBarHLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
|
|
|
@ -10,19 +10,21 @@
|
|||
<height>320</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<layout class="QVBoxLayout" name="FriendSelectionWidgetVLayout">
|
||||
<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>
|
||||
<widget class="QLabel" name="filterLabel">
|
||||
<property name="text">
|
||||
<string>Search :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QHBoxLayout" name="filterHLayout">
|
||||
<item>
|
||||
<widget class="LineEditClear" name="filterLineEdit"/>
|
||||
</item>
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
#include <iostream>
|
||||
|
||||
#include "GroupTreeWidget.h"
|
||||
#include "ui_GroupTreeWidget.h"
|
||||
|
||||
|
@ -58,6 +60,8 @@
|
|||
#define ROLE_SUBSCRIBE_FLAGS Qt::UserRole + 8
|
||||
#define ROLE_COLOR Qt::UserRole + 9
|
||||
#define ROLE_SAVED_ICON Qt::UserRole + 10
|
||||
#define ROLE_SEARCH_STRING Qt::UserRole + 11
|
||||
#define ROLE_REQUEST_ID Qt::UserRole + 12
|
||||
|
||||
#define FILTER_NAME_INDEX 0
|
||||
#define FILTER_DESC_INDEX 1
|
||||
|
@ -132,6 +136,10 @@ GroupTreeWidget::GroupTreeWidget(QWidget *parent) :
|
|||
ui->filterLineEdit->addFilter(QIcon(), tr("Description"), FILTER_DESC_INDEX , tr("Search Description"));
|
||||
ui->filterLineEdit->setCurrentFilter(FILTER_NAME_INDEX);
|
||||
|
||||
ui->distantSearchLineEdit->setPlaceholderText(tr("Search entire network...")) ;
|
||||
|
||||
connect(ui->distantSearchLineEdit,SIGNAL(returnPressed()),this,SLOT(distantSearch())) ;
|
||||
|
||||
/* Initialize display button */
|
||||
initDisplayMenu(ui->displayButton);
|
||||
|
||||
|
@ -407,6 +415,54 @@ QTreeWidgetItem *GroupTreeWidget::addCategoryItem(const QString &name, const QIc
|
|||
return item;
|
||||
}
|
||||
|
||||
void GroupTreeWidget::removeSearchItem(QTreeWidgetItem *item)
|
||||
{
|
||||
ui->treeWidget->takeTopLevelItem(ui->treeWidget->indexOfTopLevelItem(item)) ;
|
||||
}
|
||||
|
||||
QTreeWidgetItem *GroupTreeWidget::addSearchItem(const QString& search_string, uint32_t id, const QIcon& icon)
|
||||
{
|
||||
QTreeWidgetItem *item = addCategoryItem(search_string,icon,true);
|
||||
|
||||
item->setData(COLUMN_DATA,ROLE_SEARCH_STRING,search_string) ;
|
||||
item->setData(COLUMN_DATA,ROLE_REQUEST_ID ,id) ;
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
void GroupTreeWidget::setDistSearchVisible(bool visible)
|
||||
{
|
||||
ui->distantSearchLineEdit->setVisible(visible);
|
||||
}
|
||||
|
||||
bool GroupTreeWidget::isSearchRequestResult(QPoint &point,QString& group_id,uint32_t& search_req_id)
|
||||
{
|
||||
QTreeWidgetItem *item = ui->treeWidget->itemAt(point);
|
||||
if (item == NULL)
|
||||
return false;
|
||||
|
||||
QTreeWidgetItem *parent = item->parent();
|
||||
|
||||
if(parent == NULL)
|
||||
return false ;
|
||||
|
||||
search_req_id = parent->data(COLUMN_DATA, ROLE_REQUEST_ID).toUInt();
|
||||
group_id = itemId(item) ;
|
||||
|
||||
return search_req_id > 0;
|
||||
}
|
||||
|
||||
bool GroupTreeWidget::isSearchRequestItem(QPoint &point,uint32_t& search_req_id)
|
||||
{
|
||||
QTreeWidgetItem *item = ui->treeWidget->itemAt(point);
|
||||
if (item == NULL)
|
||||
return false;
|
||||
|
||||
search_req_id = item->data(COLUMN_DATA, ROLE_REQUEST_ID).toUInt();
|
||||
|
||||
return search_req_id > 0;
|
||||
}
|
||||
|
||||
QString GroupTreeWidget::itemId(QTreeWidgetItem *item)
|
||||
{
|
||||
if (item == NULL) {
|
||||
|
@ -770,6 +826,13 @@ void GroupTreeWidget::resort(QTreeWidgetItem *categoryItem)
|
|||
}
|
||||
}
|
||||
|
||||
void GroupTreeWidget::distantSearch()
|
||||
{
|
||||
emit distantSearchRequested(ui->distantSearchLineEdit->text());
|
||||
|
||||
ui->distantSearchLineEdit->clear();
|
||||
}
|
||||
|
||||
void GroupTreeWidget::sort()
|
||||
{
|
||||
resort(NULL);
|
||||
|
|
|
@ -82,6 +82,11 @@ public:
|
|||
|
||||
// Add a new category item
|
||||
QTreeWidgetItem *addCategoryItem(const QString &name, const QIcon &icon, bool expand);
|
||||
// Add a new search item
|
||||
void setDistSearchVisible(bool) ; // shows/hides distant search UI parts.
|
||||
QTreeWidgetItem *addSearchItem(const QString& search_string, uint32_t id, const QIcon &icon) ;
|
||||
void removeSearchItem(QTreeWidgetItem *item);
|
||||
|
||||
// Get id of item
|
||||
QString itemId(QTreeWidgetItem *item);
|
||||
QString itemIdAt(QPoint &point);
|
||||
|
@ -90,6 +95,9 @@ public:
|
|||
// Set the unread count of an item
|
||||
void setUnreadCount(QTreeWidgetItem *item, int unreadCount);
|
||||
|
||||
bool isSearchRequestItem(QPoint &point,uint32_t& search_req_id);
|
||||
bool isSearchRequestResult(QPoint &point, QString &group_id, uint32_t& search_req_id);
|
||||
|
||||
QTreeWidgetItem *getItemFromId(const QString &id);
|
||||
QTreeWidgetItem *activateId(const QString &id, bool focus);
|
||||
|
||||
|
@ -110,6 +118,7 @@ signals:
|
|||
void treeCustomContextMenuRequested(const QPoint &pos);
|
||||
void treeCurrentItemChanged(const QString &id);
|
||||
void treeItemActivated(const QString &id);
|
||||
void distantSearchRequested(const QString&) ;
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
@ -119,6 +128,7 @@ private slots:
|
|||
void currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
|
||||
void itemActivated(QTreeWidgetItem *item, int column);
|
||||
void filterChanged();
|
||||
void distantSearch();
|
||||
|
||||
void sort();
|
||||
|
||||
|
|
|
@ -124,6 +124,13 @@
|
|||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="distantSearchLineEdit">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Searches a single keyword into the reachable network.</p><p>Objects already provided by friend nodes are not reported.</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
|
|
|
@ -107,7 +107,7 @@ QVariant RSTextBrowser::loadResource(int type, const QUrl &name)
|
|||
if(fi.exists() && fi.isFile()) {
|
||||
QString cpath = fi.canonicalFilePath();
|
||||
if (cpath.startsWith(QDir(QString::fromUtf8(RsAccounts::ConfigDirectory().c_str())).canonicalPath(),Qt::CaseInsensitive)
|
||||
|| cpath.startsWith(QDir(QString::fromUtf8(RsAccounts::DataDirectory().c_str())).canonicalPath(),Qt::CaseInsensitive))
|
||||
|| cpath.startsWith(QDir(QString::fromUtf8(RsAccounts::systemDataDirectory().c_str())).canonicalPath(),Qt::CaseInsensitive))
|
||||
return QTextBrowser::loadResource(type, name);
|
||||
}}
|
||||
|
||||
|
@ -251,53 +251,22 @@ bool RSTextBrowser::checkImage(QPoint pos, QString &imageStr)
|
|||
*/
|
||||
QString RSTextBrowser::anchorForPosition(const QPoint &pos) const
|
||||
{
|
||||
// Many calls when time label shows up
|
||||
QTextCursor cursor = cursorForPosition(pos);
|
||||
cursor.select(QTextCursor::WordUnderCursor);
|
||||
QString word = cursor.selectedText();
|
||||
QString anchor = "";
|
||||
if (word.isEmpty())
|
||||
return anchor;
|
||||
|
||||
// For finding positions
|
||||
QTextCursor cursor_line = cursorForPosition(pos);
|
||||
cursor_line.select(QTextCursor::LineUnderCursor);
|
||||
QString line = cursor_line.selectedText();
|
||||
// End of nickname (more or less, of course, because some can has colon in
|
||||
// name)
|
||||
int end_of_name = line.indexOf(": ") + 1;
|
||||
// Start of nickname (after time)
|
||||
int space_index = line.indexOf(' ') + 1;
|
||||
int word_index = line.indexOf(word) + 1;
|
||||
int once = 1;
|
||||
cursor_line.movePosition(QTextCursor::StartOfLine, QTextCursor::MoveAnchor, once);
|
||||
bool after_name = cursor_line.position() + end_of_name < cursor.position();
|
||||
bool cursor_after_time = space_index < word_index;
|
||||
bool cursor_within_name = word_index <= end_of_name;
|
||||
if (!after_name && cursor_after_time && cursor_within_name) {
|
||||
cursor.movePosition(QTextCursor::StartOfLine, QTextCursor::MoveAnchor, once);
|
||||
cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::MoveAnchor,
|
||||
space_index);
|
||||
cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor,
|
||||
end_of_name - space_index);
|
||||
if (cursor.selectedText().isEmpty()) {
|
||||
return anchor;
|
||||
if (!cursor.selectedText().isEmpty()){
|
||||
QRegExp rx("<a name=\"(.*)\"",Qt::CaseSensitive, QRegExp::RegExp2);
|
||||
rx.setMinimal(true);
|
||||
QString sel = cursor.selection().toHtml();
|
||||
QStringList anchors;
|
||||
int pos=0;
|
||||
while ((pos = rx.indexIn(sel,pos)) != -1) {
|
||||
anchors << rx.cap(1);
|
||||
pos += rx.matchedLength();
|
||||
}
|
||||
if (!anchors.isEmpty()){
|
||||
anchor = anchors.at(0);
|
||||
}
|
||||
} else {
|
||||
return anchor;
|
||||
}
|
||||
|
||||
QRegExp rx("<a name=\"(.*)\"",Qt::CaseSensitive, QRegExp::RegExp2);
|
||||
rx.setMinimal(true);
|
||||
QString sel = cursor.selection().toHtml();
|
||||
QStringList anchors;
|
||||
int position = 0;
|
||||
while ((position = rx.indexIn(sel, position)) != -1) {
|
||||
anchors << rx.cap(1);
|
||||
position += rx.matchedLength();
|
||||
}
|
||||
if (!anchors.isEmpty()) {
|
||||
anchor = anchors.at(0);
|
||||
}
|
||||
return anchor;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************
|
||||
* This file is distributed under the following license:
|
||||
*
|
||||
* Copyright (c) 2008, defnax
|
||||
* This file is distributed under the following license:
|
||||
*
|
||||
* Copyright (c) 2008, defnax
|
||||
* Copyright (c) 2008, Matt Edman, Justin Hipple
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -21,12 +21,12 @@
|
|||
****************************************************************/
|
||||
|
||||
/*
|
||||
** \file html.cpp
|
||||
** \version $Id: html.cpp 2362 2008-02-29 04:30:11Z edmanm $
|
||||
** \file rshtml.cpp
|
||||
** \version $Id: rshtml.cpp 2362 2008-02-29 04:30:11Z edmanm $
|
||||
** \brief HTML formatting functions
|
||||
*/
|
||||
|
||||
#include "html.h"
|
||||
#include "rshtml.h"
|
||||
|
||||
|
||||
/** Wraps a string in "<p>" tags, converts "\n" to "<br>" and converts "\n\n"
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************
|
||||
* This file is distributed under the following license:
|
||||
*
|
||||
* Copyright (c) 2008, defnax
|
||||
* This file is distributed under the following license:
|
||||
*
|
||||
* Copyright (c) 2008, defnax
|
||||
* Copyright (c) 2008, Matt Edman, Justin Hipple
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -21,8 +21,8 @@
|
|||
****************************************************************/
|
||||
|
||||
/*
|
||||
** \file html.h
|
||||
** \version $Id: html.h 2362 2008-02-29 04:30:11Z edmanm $
|
||||
** \file rshtml.h
|
||||
** \version $Id: rshtml.h 2362 2008-02-29 04:30:11Z edmanm $
|
||||
** \brief HTML formatting functions
|
||||
*/
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************
|
||||
* This file is distributed under the following license:
|
||||
*
|
||||
* Copyright (c) 2008, defnax
|
||||
* This file is distributed under the following license:
|
||||
*
|
||||
* Copyright (c) 2008, defnax
|
||||
* Copyright (c) 2008, Matt Edman, Justin Hipple
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -26,7 +26,7 @@
|
|||
** \brief Provides a custom Vidalia mesage box
|
||||
*/
|
||||
|
||||
#include "html.h"
|
||||
#include "rshtml.h"
|
||||
#include "vmessagebox.h"
|
||||
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include <QPainter>
|
||||
|
||||
#include "arrow.h"
|
||||
#include "node.h"
|
||||
#include "elnode.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include <QPainter>
|
||||
|
||||
#include "edge.h"
|
||||
#include "node.h"
|
||||
#include "elnode.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
|
||||
#include <retroshare/rspeers.h>
|
||||
#include "edge.h"
|
||||
#include "node.h"
|
||||
#include "elnode.h"
|
||||
#include "graphwidget.h"
|
||||
|
||||
#define IMAGE_AUTHED ":/images/accepted16.png"
|
|
@ -39,8 +39,8 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef NODE_H
|
||||
#define NODE_H
|
||||
#ifndef ELNODE_H
|
||||
#define ELNODE_H
|
||||
|
||||
#include <QApplication>
|
||||
#if QT_VERSION >= 0x040600
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
#include "graphwidget.h"
|
||||
#include "edge.h"
|
||||
#include "node.h"
|
||||
#include "elnode.h"
|
||||
#include "fft.h"
|
||||
|
||||
#include <iostream>
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
#define IMAGE_EDIT ":/images/edit_16.png"
|
||||
#define IMAGE_SHARE ":/images/share-icon-16.png"
|
||||
#define IMAGE_TABNEW ":/images/tab-new.png"
|
||||
#define IMAGE_DELETE ":/images/delete.png"
|
||||
#define IMAGE_RETRIEVE ":/images/edit_add24.png"
|
||||
#define IMAGE_COMMENT ""
|
||||
|
||||
#define TOKEN_TYPE_GROUP_SUMMARY 1
|
||||
|
@ -65,7 +67,7 @@
|
|||
*/
|
||||
|
||||
/** Constructor */
|
||||
GxsGroupFrameDialog::GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, QWidget *parent)
|
||||
GxsGroupFrameDialog::GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, QWidget *parent,bool allow_dist_sync)
|
||||
: RsGxsUpdateBroadcastPage(ifaceImpl, parent)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
|
@ -73,6 +75,7 @@ GxsGroupFrameDialog::GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, QWidget *p
|
|||
ui->setupUi(this);
|
||||
|
||||
mInitialized = false;
|
||||
mDistSyncAllowed = allow_dist_sync;
|
||||
mInFill = false;
|
||||
mCountChildMsgs = false;
|
||||
mYourGroups = NULL;
|
||||
|
@ -92,13 +95,18 @@ GxsGroupFrameDialog::GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, QWidget *p
|
|||
mStateHelper->addWidget(TOKEN_TYPE_GROUP_SUMMARY, ui->loadingLabel, UISTATE_LOADING_VISIBLE);
|
||||
|
||||
connect(ui->groupTreeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT(groupTreeCustomPopupMenu(QPoint)));
|
||||
connect(ui->groupTreeWidget, SIGNAL(treeCurrentItemChanged(QString)), this, SLOT(changedGroup(QString)));
|
||||
connect(ui->groupTreeWidget, SIGNAL(treeCurrentItemChanged(QString)), this, SLOT(changedCurrentGroup(QString)));
|
||||
connect(ui->groupTreeWidget->treeWidget(), SIGNAL(signalMouseMiddleButtonClicked(QTreeWidgetItem*)), this, SLOT(groupTreeMiddleButtonClicked(QTreeWidgetItem*)));
|
||||
connect(ui->messageTabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(messageTabCloseRequested(int)));
|
||||
connect(ui->messageTabWidget, SIGNAL(currentChanged(int)), this, SLOT(messageTabChanged(int)));
|
||||
|
||||
connect(ui->todoPushButton, SIGNAL(clicked()), this, SLOT(todo()));
|
||||
|
||||
ui->groupTreeWidget->setDistSearchVisible(allow_dist_sync) ;
|
||||
|
||||
if(allow_dist_sync)
|
||||
connect(ui->groupTreeWidget, SIGNAL(distantSearchRequested(const QString&)), this, SLOT(searchNetwork(const QString&)));
|
||||
|
||||
/* Set initial size the splitter */
|
||||
ui->splitter->setStretchFactor(0, 0);
|
||||
ui->splitter->setStretchFactor(1, 1);
|
||||
|
@ -121,7 +129,7 @@ GxsGroupFrameDialog::~GxsGroupFrameDialog()
|
|||
delete(ui);
|
||||
}
|
||||
|
||||
void GxsGroupFrameDialog::getGroupList(std::list<RsGroupMetaData>& group_list)
|
||||
void GxsGroupFrameDialog::getGroupList(std::map<RsGxsGroupId, RsGroupMetaData> &group_list)
|
||||
{
|
||||
group_list = mCachedGroupMetas ;
|
||||
|
||||
|
@ -243,6 +251,56 @@ void GxsGroupFrameDialog::updateDisplay(bool complete)
|
|||
updateMessageSummaryList(msgIt->first);
|
||||
}
|
||||
}
|
||||
|
||||
updateSearchResults() ;
|
||||
}
|
||||
|
||||
void GxsGroupFrameDialog::updateSearchResults()
|
||||
{
|
||||
const std::set<TurtleRequestId>& reqs = getSearchResults();
|
||||
|
||||
for(auto it(reqs.begin());it!=reqs.end();++it)
|
||||
{
|
||||
std::cerr << "updating search ID " << std::hex << *it << std::dec << std::endl;
|
||||
|
||||
std::map<RsGxsGroupId,RsGxsGroupSummary> group_infos;
|
||||
|
||||
getDistantSearchResults(*it,group_infos) ;
|
||||
|
||||
std::cerr << "retrieved " << std::endl;
|
||||
|
||||
auto it2 = mSearchGroupsItems.find(*it);
|
||||
|
||||
if(mSearchGroupsItems.end() == it2)
|
||||
{
|
||||
std::cerr << "GxsGroupFrameDialog::updateSearchResults(): received result notification for req " << std::hex << *it << std::dec << " but no item present!" << std::endl;
|
||||
continue ; // we could create the item just as well but since this situation is not supposed to happen, I prefer to make this a failure case.
|
||||
}
|
||||
|
||||
QList<GroupItemInfo> group_items ;
|
||||
|
||||
for(auto it3(group_infos.begin());it3!=group_infos.end();++it3)
|
||||
if(mCachedGroupMetas.find(it3->first) == mCachedGroupMetas.end())
|
||||
{
|
||||
std::cerr << " adding new group " << it3->first << " "
|
||||
<< it3->second.mGroupId << " \""
|
||||
<< it3->second.mGroupName << "\"" << std::endl;
|
||||
|
||||
GroupItemInfo i;
|
||||
i.id = QString(it3->second.mGroupId.toStdString().c_str());
|
||||
i.name = QString::fromUtf8(it3->second.mGroupName.c_str());
|
||||
i.popularity = 0; // could be set to the number of hits
|
||||
i.lastpost = QDateTime::fromTime_t(it3->second.mLastMessageTs);
|
||||
i.subscribeFlags = 0; // irrelevant here
|
||||
i.publishKey = false ; // IS_GROUP_PUBLISHER(groupInfo.mSubscribeFlags);
|
||||
i.adminKey = false ; // IS_GROUP_ADMIN(groupInfo.mSubscribeFlags);
|
||||
i.max_visible_posts = it3->second.mNumberOfMessages;
|
||||
|
||||
group_items.push_back(i);
|
||||
}
|
||||
|
||||
ui->groupTreeWidget->fillGroupItems(it2->second, group_items);
|
||||
}
|
||||
}
|
||||
|
||||
void GxsGroupFrameDialog::todo()
|
||||
|
@ -250,98 +308,149 @@ void GxsGroupFrameDialog::todo()
|
|||
QMessageBox::information(this, "Todo", text(TEXT_TODO));
|
||||
}
|
||||
|
||||
void GxsGroupFrameDialog::removeCurrentSearch()
|
||||
{
|
||||
QAction *action = dynamic_cast<QAction*>(sender()) ;
|
||||
|
||||
if(!action)
|
||||
return ;
|
||||
|
||||
TurtleRequestId search_request_id = action->data().toUInt();
|
||||
|
||||
auto it = mSearchGroupsItems.find(search_request_id) ;
|
||||
|
||||
if(it == mSearchGroupsItems.end())
|
||||
return ;
|
||||
|
||||
ui->groupTreeWidget->removeSearchItem(it->second) ;
|
||||
mSearchGroupsItems.erase(it);
|
||||
|
||||
mKnownGroups.erase(search_request_id);
|
||||
}
|
||||
|
||||
void GxsGroupFrameDialog::removeAllSearches()
|
||||
{
|
||||
for(auto it(mSearchGroupsItems.begin());it!=mSearchGroupsItems.end();++it)
|
||||
ui->groupTreeWidget->removeSearchItem(it->second) ;
|
||||
|
||||
mSearchGroupsItems.clear();
|
||||
mKnownGroups.clear();
|
||||
}
|
||||
void GxsGroupFrameDialog::groupTreeCustomPopupMenu(QPoint point)
|
||||
{
|
||||
QMenu contextMnu(this);
|
||||
// First separately handle the case of search top level items
|
||||
|
||||
TurtleRequestId search_request_id = 0 ;
|
||||
|
||||
if(ui->groupTreeWidget->isSearchRequestItem(point,search_request_id))
|
||||
{
|
||||
QMenu contextMnu(this);
|
||||
|
||||
contextMnu.addAction(QIcon(IMAGE_DELETE), tr("Remove this search"), this, SLOT(removeCurrentSearch()))->setData(search_request_id);
|
||||
contextMnu.addAction(QIcon(IMAGE_DELETE), tr("Remove all searches"), this, SLOT(removeAllSearches()));
|
||||
contextMnu.exec(QCursor::pos());
|
||||
return ;
|
||||
}
|
||||
|
||||
// Then check whether we have a searched item, or a normal group
|
||||
|
||||
QString group_id_s ;
|
||||
|
||||
if(ui->groupTreeWidget->isSearchRequestResult(point,group_id_s,search_request_id))
|
||||
{
|
||||
QMenu contextMnu(this);
|
||||
|
||||
contextMnu.addAction(QIcon(IMAGE_RETRIEVE), tr("Request data"), this, SLOT(distantRequestGroupData()))->setData(group_id_s);
|
||||
contextMnu.exec(QCursor::pos());
|
||||
return ;
|
||||
}
|
||||
|
||||
QString id = ui->groupTreeWidget->itemIdAt(point);
|
||||
if (!id.isEmpty())
|
||||
{
|
||||
if (id.isEmpty()) return;
|
||||
|
||||
mGroupId = RsGxsGroupId(id.toStdString());
|
||||
int subscribeFlags = ui->groupTreeWidget->subscribeFlags(QString::fromStdString(mGroupId.toStdString()));
|
||||
mGroupId = RsGxsGroupId(id.toStdString());
|
||||
int subscribeFlags = ui->groupTreeWidget->subscribeFlags(QString::fromStdString(mGroupId.toStdString()));
|
||||
|
||||
bool isAdmin = IS_GROUP_ADMIN(subscribeFlags);
|
||||
bool isPublisher = IS_GROUP_PUBLISHER(subscribeFlags);
|
||||
bool isSubscribed = IS_GROUP_SUBSCRIBED(subscribeFlags);
|
||||
bool isAdmin = IS_GROUP_ADMIN(subscribeFlags);
|
||||
bool isPublisher = IS_GROUP_PUBLISHER(subscribeFlags);
|
||||
bool isSubscribed = IS_GROUP_SUBSCRIBED(subscribeFlags);
|
||||
|
||||
QMenu contextMnu(this);
|
||||
QAction *action;
|
||||
|
||||
QAction *action;
|
||||
|
||||
if (mMessageWidget) {
|
||||
action = contextMnu.addAction(QIcon(IMAGE_TABNEW), tr("Open in new tab"), this, SLOT(openInNewTab()));
|
||||
if (mGroupId.isNull() || messageWidget(mGroupId, true)) {
|
||||
action->setEnabled(false);
|
||||
}
|
||||
if (mMessageWidget) {
|
||||
action = contextMnu.addAction(QIcon(IMAGE_TABNEW), tr("Open in new tab"), this, SLOT(openInNewTab()));
|
||||
if (mGroupId.isNull() || messageWidget(mGroupId, true)) {
|
||||
action->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (isSubscribed) {
|
||||
action = contextMnu.addAction(QIcon(IMAGE_UNSUBSCRIBE), tr("Unsubscribe"), this, SLOT(unsubscribeGroup()));
|
||||
action->setEnabled (!mGroupId.isNull() && IS_GROUP_SUBSCRIBED(subscribeFlags));
|
||||
} else {
|
||||
action = contextMnu.addAction(QIcon(IMAGE_SUBSCRIBE), tr("Subscribe"), this, SLOT(subscribeGroup()));
|
||||
action->setDisabled (mGroupId.isNull() || IS_GROUP_SUBSCRIBED(subscribeFlags));
|
||||
}
|
||||
if (isSubscribed) {
|
||||
action = contextMnu.addAction(QIcon(IMAGE_UNSUBSCRIBE), tr("Unsubscribe"), this, SLOT(unsubscribeGroup()));
|
||||
action->setEnabled (!mGroupId.isNull() && IS_GROUP_SUBSCRIBED(subscribeFlags));
|
||||
} else {
|
||||
action = contextMnu.addAction(QIcon(IMAGE_SUBSCRIBE), tr("Subscribe"), this, SLOT(subscribeGroup()));
|
||||
action->setDisabled (mGroupId.isNull() || IS_GROUP_SUBSCRIBED(subscribeFlags));
|
||||
}
|
||||
|
||||
contextMnu.addSeparator();
|
||||
|
||||
contextMnu.addAction(QIcon(icon(ICON_NEW)), text(TEXT_NEW), this, SLOT(newGroup()));
|
||||
|
||||
action = contextMnu.addAction(QIcon(IMAGE_INFO), tr("Show Details"), this, SLOT(showGroupDetails()));
|
||||
action->setEnabled (!mGroupId.isNull());
|
||||
|
||||
action = contextMnu.addAction(QIcon(IMAGE_EDIT), tr("Edit Details"), this, SLOT(editGroupDetails()));
|
||||
action->setEnabled (!mGroupId.isNull() && isAdmin);
|
||||
|
||||
uint32_t current_store_time = mInterface->getStoragePeriod(mGroupId)/86400 ;
|
||||
uint32_t current_sync_time = mInterface->getSyncPeriod(mGroupId)/86400 ;
|
||||
|
||||
std::cerr << "Got sync=" << current_sync_time << ". store=" << current_store_time << std::endl;
|
||||
QAction *actnn = NULL;
|
||||
|
||||
QMenu *ctxMenu2 = contextMnu.addMenu(tr("Synchronise posts of last...")) ;
|
||||
actnn = ctxMenu2->addAction(tr(" 5 days" ),this,SLOT(setSyncPostsDelay())) ; actnn->setData(QVariant( 5)) ; if(current_sync_time == 5) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
actnn = ctxMenu2->addAction(tr(" 2 weeks" ),this,SLOT(setSyncPostsDelay())) ; actnn->setData(QVariant( 15)) ; if(current_sync_time == 15) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
actnn = ctxMenu2->addAction(tr(" 1 month" ),this,SLOT(setSyncPostsDelay())) ; actnn->setData(QVariant( 30)) ; if(current_sync_time == 30) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
actnn = ctxMenu2->addAction(tr(" 3 months" ),this,SLOT(setSyncPostsDelay())) ; actnn->setData(QVariant( 90)) ; if(current_sync_time == 90) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
actnn = ctxMenu2->addAction(tr(" 6 months" ),this,SLOT(setSyncPostsDelay())) ; actnn->setData(QVariant(180)) ; if(current_sync_time ==180) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
actnn = ctxMenu2->addAction(tr(" 1 year " ),this,SLOT(setSyncPostsDelay())) ; actnn->setData(QVariant(372)) ; if(current_sync_time ==372) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
actnn = ctxMenu2->addAction(tr(" Indefinitly"),this,SLOT(setSyncPostsDelay())) ; actnn->setData(QVariant( 0)) ; if(current_sync_time == 0) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
|
||||
ctxMenu2 = contextMnu.addMenu(tr("Store posts for at most...")) ;
|
||||
actnn = ctxMenu2->addAction(tr(" 5 days" ),this,SLOT(setStorePostsDelay())) ; actnn->setData(QVariant( 5)) ; if(current_store_time == 5) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
actnn = ctxMenu2->addAction(tr(" 2 weeks" ),this,SLOT(setStorePostsDelay())) ; actnn->setData(QVariant( 15)) ; if(current_store_time == 15) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
actnn = ctxMenu2->addAction(tr(" 1 month" ),this,SLOT(setStorePostsDelay())) ; actnn->setData(QVariant( 30)) ; if(current_store_time == 30) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
actnn = ctxMenu2->addAction(tr(" 3 months" ),this,SLOT(setStorePostsDelay())) ; actnn->setData(QVariant( 90)) ; if(current_store_time == 90) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
actnn = ctxMenu2->addAction(tr(" 6 months" ),this,SLOT(setStorePostsDelay())) ; actnn->setData(QVariant(180)) ; if(current_store_time ==180) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
actnn = ctxMenu2->addAction(tr(" 1 year " ),this,SLOT(setStorePostsDelay())) ; actnn->setData(QVariant(372)) ; if(current_store_time ==372) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
actnn = ctxMenu2->addAction(tr(" Indefinitly"),this,SLOT(setStorePostsDelay())) ; actnn->setData(QVariant( 0)) ; if(current_store_time == 0) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
|
||||
if (shareKeyType()) {
|
||||
action = contextMnu.addAction(QIcon(IMAGE_SHARE), tr("Share publish permissions"), this, SLOT(sharePublishKey()));
|
||||
action->setEnabled(!mGroupId.isNull() && isPublisher);
|
||||
}
|
||||
|
||||
if (getLinkType() != RetroShareLink::TYPE_UNKNOWN) {
|
||||
action = contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyGroupLink()));
|
||||
action->setEnabled(!mGroupId.isNull());
|
||||
}
|
||||
|
||||
contextMnu.addSeparator();
|
||||
|
||||
action = contextMnu.addAction(QIcon(":/images/message-mail-read.png"), tr("Mark all as read"), this, SLOT(markMsgAsRead()));
|
||||
action->setEnabled (!mGroupId.isNull() && isSubscribed);
|
||||
|
||||
action = contextMnu.addAction(QIcon(":/images/message-mail.png"), tr("Mark all as unread"), this, SLOT(markMsgAsUnread()));
|
||||
action->setEnabled (!mGroupId.isNull() && isSubscribed);
|
||||
|
||||
/* Add special actions */
|
||||
QList<QAction*> actions;
|
||||
groupTreeCustomActions(mGroupId, subscribeFlags, actions);
|
||||
if (!actions.isEmpty()) {
|
||||
contextMnu.addSeparator();
|
||||
|
||||
contextMnu.addAction(QIcon(icon(ICON_NEW)), text(TEXT_NEW), this, SLOT(newGroup()));
|
||||
|
||||
action = contextMnu.addAction(QIcon(IMAGE_INFO), tr("Show Details"), this, SLOT(showGroupDetails()));
|
||||
action->setEnabled (!mGroupId.isNull());
|
||||
|
||||
action = contextMnu.addAction(QIcon(IMAGE_EDIT), tr("Edit Details"), this, SLOT(editGroupDetails()));
|
||||
action->setEnabled (!mGroupId.isNull() && isAdmin);
|
||||
|
||||
uint32_t current_store_time = mInterface->getStoragePeriod(mGroupId)/86400 ;
|
||||
uint32_t current_sync_time = mInterface->getSyncPeriod(mGroupId)/86400 ;
|
||||
|
||||
std::cerr << "Got sync=" << current_sync_time << ". store=" << current_store_time << std::endl;
|
||||
QAction *actnn = NULL;
|
||||
|
||||
QMenu *ctxMenu2 = contextMnu.addMenu(tr("Synchronise posts of last...")) ;
|
||||
actnn = ctxMenu2->addAction(tr(" 5 days" ),this,SLOT(setSyncPostsDelay())) ; actnn->setData(QVariant( 5)) ; if(current_sync_time == 5) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
actnn = ctxMenu2->addAction(tr(" 2 weeks" ),this,SLOT(setSyncPostsDelay())) ; actnn->setData(QVariant( 15)) ; if(current_sync_time == 15) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
actnn = ctxMenu2->addAction(tr(" 1 month" ),this,SLOT(setSyncPostsDelay())) ; actnn->setData(QVariant( 30)) ; if(current_sync_time == 30) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
actnn = ctxMenu2->addAction(tr(" 3 months" ),this,SLOT(setSyncPostsDelay())) ; actnn->setData(QVariant( 90)) ; if(current_sync_time == 90) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
actnn = ctxMenu2->addAction(tr(" 6 months" ),this,SLOT(setSyncPostsDelay())) ; actnn->setData(QVariant(180)) ; if(current_sync_time ==180) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
actnn = ctxMenu2->addAction(tr(" 1 year " ),this,SLOT(setSyncPostsDelay())) ; actnn->setData(QVariant(372)) ; if(current_sync_time ==372) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
actnn = ctxMenu2->addAction(tr(" Indefinitly"),this,SLOT(setSyncPostsDelay())) ; actnn->setData(QVariant( 0)) ; if(current_sync_time == 0) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
|
||||
ctxMenu2 = contextMnu.addMenu(tr("Store posts for at most...")) ;
|
||||
actnn = ctxMenu2->addAction(tr(" 5 days" ),this,SLOT(setStorePostsDelay())) ; actnn->setData(QVariant( 5)) ; if(current_store_time == 5) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
actnn = ctxMenu2->addAction(tr(" 2 weeks" ),this,SLOT(setStorePostsDelay())) ; actnn->setData(QVariant( 15)) ; if(current_store_time == 15) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
actnn = ctxMenu2->addAction(tr(" 1 month" ),this,SLOT(setStorePostsDelay())) ; actnn->setData(QVariant( 30)) ; if(current_store_time == 30) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
actnn = ctxMenu2->addAction(tr(" 3 months" ),this,SLOT(setStorePostsDelay())) ; actnn->setData(QVariant( 90)) ; if(current_store_time == 90) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
actnn = ctxMenu2->addAction(tr(" 6 months" ),this,SLOT(setStorePostsDelay())) ; actnn->setData(QVariant(180)) ; if(current_store_time ==180) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
actnn = ctxMenu2->addAction(tr(" 1 year " ),this,SLOT(setStorePostsDelay())) ; actnn->setData(QVariant(372)) ; if(current_store_time ==372) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
actnn = ctxMenu2->addAction(tr(" Indefinitly"),this,SLOT(setStorePostsDelay())) ; actnn->setData(QVariant( 0)) ; if(current_store_time == 0) { actnn->setEnabled(false);actnn->setIcon(QIcon(":/images/start.png"));}
|
||||
|
||||
if (shareKeyType()) {
|
||||
action = contextMnu.addAction(QIcon(IMAGE_SHARE), tr("Share publish permissions"), this, SLOT(sharePublishKey()));
|
||||
action->setEnabled(!mGroupId.isNull() && isPublisher);
|
||||
}
|
||||
|
||||
if (getLinkType() != RetroShareLink::TYPE_UNKNOWN) {
|
||||
action = contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyGroupLink()));
|
||||
action->setEnabled(!mGroupId.isNull());
|
||||
}
|
||||
|
||||
contextMnu.addSeparator();
|
||||
|
||||
action = contextMnu.addAction(QIcon(":/images/message-mail-read.png"), tr("Mark all as read"), this, SLOT(markMsgAsRead()));
|
||||
action->setEnabled (!mGroupId.isNull() && isSubscribed);
|
||||
|
||||
action = contextMnu.addAction(QIcon(":/images/message-mail.png"), tr("Mark all as unread"), this, SLOT(markMsgAsUnread()));
|
||||
action->setEnabled (!mGroupId.isNull() && isSubscribed);
|
||||
|
||||
/* Add special actions */
|
||||
QList<QAction*> actions;
|
||||
groupTreeCustomActions(mGroupId, subscribeFlags, actions);
|
||||
if (!actions.isEmpty()) {
|
||||
contextMnu.addSeparator();
|
||||
contextMnu.addActions(actions);
|
||||
}
|
||||
contextMnu.addActions(actions);
|
||||
}
|
||||
|
||||
//Add Standard Menu
|
||||
|
@ -594,7 +703,7 @@ bool GxsGroupFrameDialog::navigate(const RsGxsGroupId &groupId, const RsGxsMessa
|
|||
return false;
|
||||
}
|
||||
|
||||
changedGroup(groupIdString);
|
||||
changedCurrentGroup(groupIdString);
|
||||
|
||||
/* search exisiting tab */
|
||||
GxsMessageFrameWidget *msgWidget = messageWidget(mGroupId, false);
|
||||
|
@ -655,7 +764,7 @@ GxsCommentDialog *GxsGroupFrameDialog::commentWidget(const RsGxsMessageId& msgId
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void GxsGroupFrameDialog::changedGroup(const QString &groupId)
|
||||
void GxsGroupFrameDialog::changedCurrentGroup(const QString &groupId)
|
||||
{
|
||||
if (mInFill) {
|
||||
return;
|
||||
|
@ -798,7 +907,7 @@ void GxsGroupFrameDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupI
|
|||
}
|
||||
}
|
||||
|
||||
void GxsGroupFrameDialog::insertGroupsData(const std::list<RsGroupMetaData> &groupList, const RsUserdata *userdata)
|
||||
void GxsGroupFrameDialog::insertGroupsData(const std::map<RsGxsGroupId,RsGroupMetaData> &groupList, const RsUserdata *userdata)
|
||||
{
|
||||
if (!mInitialized) {
|
||||
return;
|
||||
|
@ -806,20 +915,18 @@ void GxsGroupFrameDialog::insertGroupsData(const std::list<RsGroupMetaData> &gro
|
|||
|
||||
mInFill = true;
|
||||
|
||||
std::list<RsGroupMetaData>::const_iterator it;
|
||||
|
||||
QList<GroupItemInfo> adminList;
|
||||
QList<GroupItemInfo> subList;
|
||||
QList<GroupItemInfo> popList;
|
||||
QList<GroupItemInfo> otherList;
|
||||
std::multimap<uint32_t, GroupItemInfo> popMap;
|
||||
|
||||
for (it = groupList.begin(); it != groupList.end(); ++it) {
|
||||
for (auto it = groupList.begin(); it != groupList.end(); ++it) {
|
||||
/* sort it into Publish (Own), Subscribed, Popular and Other */
|
||||
uint32_t flags = it->mSubscribeFlags;
|
||||
uint32_t flags = it->second.mSubscribeFlags;
|
||||
|
||||
GroupItemInfo groupItemInfo;
|
||||
groupInfoToGroupItemInfo(*it, groupItemInfo, userdata);
|
||||
groupInfoToGroupItemInfo(it->second, groupItemInfo, userdata);
|
||||
|
||||
if (IS_GROUP_SUBSCRIBED(flags))
|
||||
{
|
||||
|
@ -836,7 +943,7 @@ void GxsGroupFrameDialog::insertGroupsData(const std::list<RsGroupMetaData> &gro
|
|||
else
|
||||
{
|
||||
//popMap.insert(std::make_pair(it->mPop, groupItemInfo)); /* rate the others by popularity */
|
||||
popMap.insert(std::make_pair(it->mLastPost, groupItemInfo)); /* rate the others by time of last post */
|
||||
popMap.insert(std::make_pair(it->second.mLastPost, groupItemInfo)); /* rate the others by time of last post */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -947,9 +1054,12 @@ void GxsGroupFrameDialog::loadGroupSummary(const uint32_t &token)
|
|||
RsUserdata *userdata = NULL;
|
||||
loadGroupSummaryToken(token, groupInfo, userdata);
|
||||
|
||||
mCachedGroupMetas = groupInfo ;
|
||||
mCachedGroupMetas.clear();
|
||||
for(auto it(groupInfo.begin());it!=groupInfo.end();++it)
|
||||
mCachedGroupMetas[(*it).mGroupId] = *it;
|
||||
|
||||
insertGroupsData(groupInfo, userdata);
|
||||
insertGroupsData(mCachedGroupMetas, userdata);
|
||||
updateSearchResults();
|
||||
|
||||
mStateHelper->setLoading(TOKEN_TYPE_GROUP_SUMMARY, false);
|
||||
|
||||
|
@ -1083,3 +1193,41 @@ void GxsGroupFrameDialog::loadRequest(const TokenQueue *queue, const TokenReques
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
TurtleRequestId GxsGroupFrameDialog::distantSearch(const QString& search_string) // this should be overloaded in the child class
|
||||
{
|
||||
std::cerr << "Searching for \"" << search_string.toStdString() << "\". Function is not overloaded, so nothing will happen." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GxsGroupFrameDialog::searchNetwork(const QString& search_string)
|
||||
{
|
||||
if(search_string.isNull())
|
||||
return ;
|
||||
|
||||
uint32_t request_id = distantSearch(search_string);
|
||||
|
||||
if(request_id == 0)
|
||||
return ;
|
||||
|
||||
mSearchGroupsItems[request_id] = ui->groupTreeWidget->addSearchItem(tr("Search for")+ " \"" + search_string + "\"",(uint32_t)request_id,QIcon(icon(ICON_SEARCH)));
|
||||
}
|
||||
|
||||
void GxsGroupFrameDialog::distantRequestGroupData()
|
||||
{
|
||||
QAction *action = dynamic_cast<QAction*>(sender()) ;
|
||||
|
||||
if(!action)
|
||||
return ;
|
||||
|
||||
RsGxsGroupId group_id(action->data().toString().toStdString());
|
||||
|
||||
if(group_id.isNull())
|
||||
{
|
||||
std::cerr << "Cannot retrieve group! Group id is null!" << std::endl;
|
||||
}
|
||||
|
||||
std::cerr << "Explicit request for group " << group_id << std::endl;
|
||||
checkRequestGroup(group_id) ;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,11 +67,12 @@ public:
|
|||
ICON_SUBSCRIBED_GROUP,
|
||||
ICON_POPULAR_GROUP,
|
||||
ICON_OTHER_GROUP,
|
||||
ICON_SEARCH,
|
||||
ICON_DEFAULT
|
||||
};
|
||||
|
||||
public:
|
||||
GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, QWidget *parent = 0);
|
||||
GxsGroupFrameDialog(RsGxsIfaceHelper *ifaceImpl, QWidget *parent = 0,bool allow_dist_sync=false);
|
||||
virtual ~GxsGroupFrameDialog();
|
||||
|
||||
bool navigate(const RsGxsGroupId &groupId, const RsGxsMessageId& msgId);
|
||||
|
@ -81,7 +82,7 @@ public:
|
|||
|
||||
virtual QString getHelpString() const =0;
|
||||
|
||||
virtual void getGroupList(std::list<RsGroupMetaData>& groups) ;
|
||||
virtual void getGroupList(std::map<RsGxsGroupId,RsGroupMetaData> &groups) ;
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent *event);
|
||||
|
@ -94,6 +95,7 @@ protected:
|
|||
virtual RetroShareLink::enumType getLinkType() = 0;
|
||||
virtual GroupFrameSettings::Type groupFrameSettingsType() { return GroupFrameSettings::Nothing; }
|
||||
virtual void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata);
|
||||
virtual void checkRequestGroup(const RsGxsGroupId& /* grpId */) {} // overload this one in order to retrieve full group data when the group is browsed
|
||||
|
||||
private slots:
|
||||
void todo();
|
||||
|
@ -106,8 +108,9 @@ private slots:
|
|||
|
||||
void restoreGroupKeys();
|
||||
void newGroup();
|
||||
void distantRequestGroupData();
|
||||
|
||||
void changedGroup(const QString &groupId);
|
||||
void changedCurrentGroup(const QString &groupId);
|
||||
void groupTreeMiddleButtonClicked(QTreeWidgetItem *item);
|
||||
void openInNewTab();
|
||||
void messageTabCloseRequested(int index);
|
||||
|
@ -130,10 +133,15 @@ private slots:
|
|||
|
||||
void loadComment(const RsGxsGroupId &grpId, const QVector<RsGxsMessageId>& msg_versions,const RsGxsMessageId &most_recent_msgId, const QString &title);
|
||||
|
||||
void searchNetwork(const QString &search_string) ;
|
||||
void removeAllSearches();
|
||||
void removeCurrentSearch();
|
||||
|
||||
private:
|
||||
virtual QString text(TextType type) = 0;
|
||||
virtual QString icon(IconType type) = 0;
|
||||
virtual QString settingsGroupName() = 0;
|
||||
virtual TurtleRequestId distantSearch(const QString& search_string) ;
|
||||
|
||||
virtual GxsGroupDialog *createNewGroupDialog(TokenQueue *tokenQueue) = 0;
|
||||
virtual GxsGroupDialog *createGroupDialog(TokenQueue *tokenQueue, RsTokenService *tokenService, GxsGroupDialog::Mode mode, RsGxsGroupId groupId) = 0;
|
||||
|
@ -142,10 +150,12 @@ private:
|
|||
virtual void groupTreeCustomActions(RsGxsGroupId /*grpId*/, int /*subscribeFlags*/, QList<QAction*> &/*actions*/) {}
|
||||
virtual RsGxsCommentService *getCommentService() { return NULL; }
|
||||
virtual QWidget *createCommentHeaderWidget(const RsGxsGroupId &/*grpId*/, const RsGxsMessageId &/*msgId*/) { return NULL; }
|
||||
virtual bool getDistantSearchResults(TurtleRequestId /* id */, std::map<RsGxsGroupId,RsGxsGroupSummary>& /* group_infos */){ return false ;}
|
||||
|
||||
void initUi();
|
||||
|
||||
void updateMessageSummaryList(RsGxsGroupId groupId);
|
||||
void updateSearchResults();
|
||||
|
||||
void openGroupInNewTab(const RsGxsGroupId &groupId);
|
||||
void groupSubscribe(bool subscribe);
|
||||
|
@ -153,7 +163,7 @@ private:
|
|||
void processSettings(bool load);
|
||||
|
||||
// New Request/Response Loading Functions.
|
||||
void insertGroupsData(const std::list<RsGroupMetaData> &groupList, const RsUserdata *userdata);
|
||||
void insertGroupsData(const std::map<RsGxsGroupId, RsGroupMetaData> &groupList, const RsUserdata *userdata);
|
||||
|
||||
void requestGroupSummary();
|
||||
void loadGroupSummary(const uint32_t &token);
|
||||
|
@ -180,6 +190,7 @@ protected:
|
|||
private:
|
||||
bool mInitialized;
|
||||
bool mInFill;
|
||||
bool mDistSyncAllowed;
|
||||
QString mSettingsName;
|
||||
RsGxsGroupId mGroupId;
|
||||
RsGxsIfaceHelper *mInterface;
|
||||
|
@ -200,7 +211,10 @@ private:
|
|||
/** Qt Designer generated object */
|
||||
Ui::GxsGroupFrameDialog *ui;
|
||||
|
||||
std::list<RsGroupMetaData> mCachedGroupMetas;
|
||||
std::map<RsGxsGroupId,RsGroupMetaData> mCachedGroupMetas;
|
||||
|
||||
std::map<uint32_t,QTreeWidgetItem*> mSearchGroupsItems ;
|
||||
std::map<uint32_t,std::set<RsGxsGroupId> > mKnownGroups;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>619</width>
|
||||
<height>420</height>
|
||||
<height>493</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
|
@ -38,7 +38,16 @@
|
|||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
|
|
|
@ -57,6 +57,7 @@ protected:
|
|||
virtual void groupNameChanged(const QString &/*name*/) {}
|
||||
|
||||
virtual void clearPosts() = 0;
|
||||
virtual void blank() = 0;
|
||||
virtual bool navigatePostItem(const RsGxsMessageId& msgId) = 0;
|
||||
|
||||
/* Thread functions */
|
||||
|
|
|
@ -72,21 +72,26 @@ bool GxsMessageFrameWidget::isWaiting()
|
|||
|
||||
void GxsMessageFrameWidget::setGroupId(const RsGxsGroupId &groupId)
|
||||
{
|
||||
if (mGroupId == groupId) {
|
||||
if (!groupId.isNull()) {
|
||||
return;
|
||||
if (mGroupId == groupId && !groupId.isNull())
|
||||
return;
|
||||
|
||||
if(!groupId.isNull())
|
||||
{
|
||||
mAcknowledgeReadStatusToken = 0;
|
||||
if (mStateHelper->isLoading(mTokenTypeAcknowledgeReadStatus)) {
|
||||
mStateHelper->setLoading(mTokenTypeAcknowledgeReadStatus, false);
|
||||
|
||||
emit waitingChanged(this);
|
||||
}
|
||||
|
||||
mGroupId = groupId;
|
||||
groupIdChanged();
|
||||
}
|
||||
|
||||
mAcknowledgeReadStatusToken = 0;
|
||||
if (mStateHelper->isLoading(mTokenTypeAcknowledgeReadStatus)) {
|
||||
mStateHelper->setLoading(mTokenTypeAcknowledgeReadStatus, false);
|
||||
|
||||
emit waitingChanged(this);
|
||||
}
|
||||
|
||||
mGroupId = groupId;
|
||||
groupIdChanged();
|
||||
else
|
||||
{
|
||||
mGroupId.clear();
|
||||
blank(); // clear the displayed data, because no group is selected.
|
||||
}
|
||||
}
|
||||
|
||||
void GxsMessageFrameWidget::setAllMessagesRead(bool read)
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
virtual void groupIdChanged() = 0;
|
||||
virtual QString groupName(bool withUnreadCount) = 0;
|
||||
virtual QIcon groupIcon() = 0;
|
||||
virtual void blank() =0;
|
||||
virtual bool navigate(const RsGxsMessageId& msgId) = 0;
|
||||
virtual bool isLoading();
|
||||
virtual bool isWaiting();
|
||||
|
|
|
@ -16,12 +16,19 @@ RsGxsUpdateBroadcastBase::RsGxsUpdateBroadcastBase(RsGxsIfaceHelper *ifaceImpl,
|
|||
connect(mUpdateBroadcast, SIGNAL(changed()), this, SLOT(updateBroadcastChanged()));
|
||||
connect(mUpdateBroadcast, SIGNAL(grpsChanged(std::list<RsGxsGroupId>, std::list<RsGxsGroupId>)), this, SLOT(updateBroadcastGrpsChanged(std::list<RsGxsGroupId>,std::list<RsGxsGroupId>)));
|
||||
connect(mUpdateBroadcast, SIGNAL(msgsChanged(std::map<RsGxsGroupId,std::set<RsGxsMessageId> >, std::map<RsGxsGroupId,std::set<RsGxsMessageId> >)), this, SLOT(updateBroadcastMsgsChanged(std::map<RsGxsGroupId,std::set<RsGxsMessageId> >,std::map<RsGxsGroupId,std::set<RsGxsMessageId> >)));
|
||||
connect(mUpdateBroadcast, SIGNAL(distantSearchResultsChanged(const std::list<TurtleRequestId>&)), this, SLOT(updateBroadcastDistantSearchResultsChanged(const std::list<TurtleRequestId>&)));
|
||||
}
|
||||
|
||||
RsGxsUpdateBroadcastBase::~RsGxsUpdateBroadcastBase()
|
||||
{
|
||||
}
|
||||
|
||||
void RsGxsUpdateBroadcastBase::updateBroadcastDistantSearchResultsChanged(const std::list<TurtleRequestId>& ids)
|
||||
{
|
||||
for(auto it(ids.begin());it!=ids.end();++it)
|
||||
mTurtleResults.insert(*it);
|
||||
}
|
||||
|
||||
void RsGxsUpdateBroadcastBase::fillComplete()
|
||||
{
|
||||
mFillComplete = true;
|
||||
|
@ -37,6 +44,9 @@ void RsGxsUpdateBroadcastBase::securedUpdateDisplay()
|
|||
return;
|
||||
}
|
||||
|
||||
// This is *bad* because if the connection is done asynchronously the client will call mGrpIds, mGrpIdsMeta, etc without the guarranty that the
|
||||
// the structed havnt' been cleared in the mean time.
|
||||
|
||||
emit fillDisplay(mFillComplete);
|
||||
mFillComplete = false;
|
||||
|
||||
|
@ -75,7 +85,7 @@ void RsGxsUpdateBroadcastBase::updateBroadcastChanged()
|
|||
// The question to whether we should re=load when mGrpIds is not empty is still open. It's not harmful anyway.
|
||||
// This should probably be decided by the service itself.
|
||||
|
||||
if (!mGrpIds.empty() || !mGrpIdsMeta.empty() /*|| !mMsgIds.empty()*/ || !mMsgIdsMeta.empty())
|
||||
if (!mGrpIds.empty() || !mGrpIdsMeta.empty() /*|| !mMsgIds.empty()*/ || !mMsgIdsMeta.empty() || !mTurtleResults.empty())
|
||||
mFillComplete = true ;
|
||||
|
||||
securedUpdateDisplay();
|
||||
|
|
|
@ -7,6 +7,8 @@ class QShowEvent;
|
|||
class RsGxsIfaceHelper;
|
||||
class RsGxsUpdateBroadcast;
|
||||
|
||||
typedef uint32_t TurtleRequestId ;
|
||||
|
||||
class RsGxsUpdateBroadcastBase : public QObject
|
||||
{
|
||||
friend class RsGxsUpdateBroadcastPage;
|
||||
|
@ -25,6 +27,7 @@ public:
|
|||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIds() { return mMsgIds; }
|
||||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIdsMeta() { return mMsgIdsMeta; }
|
||||
void getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds);
|
||||
const std::set<TurtleRequestId>& getSearchResults() { return mTurtleResults ; }
|
||||
|
||||
protected:
|
||||
void fillComplete();
|
||||
|
@ -39,6 +42,7 @@ private slots:
|
|||
void updateBroadcastChanged();
|
||||
void updateBroadcastGrpsChanged(const std::list<RsGxsGroupId>& grpIds, const std::list<RsGxsGroupId> &grpIdsMeta);
|
||||
void updateBroadcastMsgsChanged(const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIds, const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIdsMeta);
|
||||
void updateBroadcastDistantSearchResultsChanged(const std::list<TurtleRequestId>& ids);
|
||||
void securedUpdateDisplay();
|
||||
|
||||
private:
|
||||
|
@ -49,4 +53,5 @@ private:
|
|||
std::set<RsGxsGroupId> mGrpIdsMeta;
|
||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgIds;
|
||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgIdsMeta;
|
||||
std::set<TurtleRequestId> mTurtleResults;
|
||||
};
|
||||
|
|
|
@ -22,6 +22,11 @@ void RsGxsUpdateBroadcastPage::setUpdateWhenInvisible(bool update)
|
|||
mBase->setUpdateWhenInvisible(update);
|
||||
}
|
||||
|
||||
const std::set<TurtleRequestId>& RsGxsUpdateBroadcastPage::getSearchResults()
|
||||
{
|
||||
return mBase->getSearchResults();
|
||||
}
|
||||
|
||||
const std::set<RsGxsGroupId> &RsGxsUpdateBroadcastPage::getGrpIdsMeta()
|
||||
{
|
||||
return mBase->getGrpIdsMeta();
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
class RsGxsIfaceHelper;
|
||||
class RsGxsUpdateBroadcastBase;
|
||||
typedef uint32_t TurtleRequestId ;
|
||||
|
||||
class RsGxsUpdateBroadcastPage : public MainPage
|
||||
{
|
||||
|
@ -30,6 +31,7 @@ public:
|
|||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIds();
|
||||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIdsMeta();
|
||||
void getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds);
|
||||
const std::set<TurtleRequestId>& getSearchResults();
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent *event);
|
||||
|
|
|
@ -29,6 +29,10 @@ const std::set<RsGxsGroupId> &RsGxsUpdateBroadcastWidget::getGrpIds()
|
|||
return mBase->getGrpIds();
|
||||
}
|
||||
|
||||
const std::set<TurtleRequestId>& RsGxsUpdateBroadcastWidget::getSearchResults()
|
||||
{
|
||||
return mBase->getSearchResults();
|
||||
}
|
||||
const std::set<RsGxsGroupId> &RsGxsUpdateBroadcastWidget::getGrpIdsMeta()
|
||||
{
|
||||
return mBase->getGrpIdsMeta();
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
class RsGxsIfaceHelper;
|
||||
class RsGxsUpdateBroadcastBase;
|
||||
typedef uint32_t TurtleRequestId;
|
||||
|
||||
class RsGxsUpdateBroadcastWidget : public QWidget
|
||||
{
|
||||
|
@ -30,6 +31,7 @@ public:
|
|||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIds();
|
||||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIdsMeta();
|
||||
void getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds);
|
||||
const std::set<TurtleRequestId>& getSearchResults() ;
|
||||
|
||||
RsGxsIfaceHelper *interfaceHelper() { return mInterfaceHelper; }
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "gui/RetroShareLink.h"
|
||||
#include "util/HandleRichText.h"
|
||||
#include "util/misc.h"
|
||||
#include "util/rsdir.h"
|
||||
|
||||
#include <retroshare/rsfiles.h>
|
||||
|
||||
|
@ -449,11 +450,10 @@ void CreateGxsChannelMsg::addAttachment(const std::string &path)
|
|||
}
|
||||
|
||||
FileInfo fInfo;
|
||||
std::string filename;
|
||||
std::string filename = RsDirUtil::getTopDir(path);
|
||||
uint64_t size = 0;
|
||||
RsFileHash hash ;
|
||||
|
||||
rsGxsChannels->ExtraFileHash(path, filename);
|
||||
rsGxsChannels->ExtraFileHash(path);
|
||||
|
||||
// Only path and filename are valid.
|
||||
// Destroyed when fileFrame (this subfileitem) is destroyed
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
|
||||
/** Constructor */
|
||||
GxsChannelDialog::GxsChannelDialog(QWidget *parent)
|
||||
: GxsGroupFrameDialog(rsGxsChannels, parent)
|
||||
: GxsGroupFrameDialog(rsGxsChannels, parent,true)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -137,6 +137,8 @@ QString GxsChannelDialog::icon(IconType type)
|
|||
return ":/images/folder_green.png";
|
||||
case ICON_OTHER_GROUP:
|
||||
return ":/images/folder_yellow.png";
|
||||
case ICON_SEARCH:
|
||||
return ":/images/find.png";
|
||||
case ICON_DEFAULT:
|
||||
return ":/images/channels.png";
|
||||
}
|
||||
|
@ -334,3 +336,24 @@ void GxsChannelDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo
|
|||
groupItemInfo.icon = iconIt.value();
|
||||
}
|
||||
}
|
||||
|
||||
TurtleRequestId GxsChannelDialog::distantSearch(const QString& search_string)
|
||||
{
|
||||
return rsGxsChannels->turtleSearchRequest(search_string.toStdString()) ;
|
||||
}
|
||||
|
||||
bool GxsChannelDialog::getDistantSearchResults(TurtleRequestId id, std::map<RsGxsGroupId,RsGxsGroupSummary>& group_infos)
|
||||
{
|
||||
return rsGxsChannels->retrieveDistantSearchResults(id,group_infos);
|
||||
}
|
||||
|
||||
void GxsChannelDialog::checkRequestGroup(const RsGxsGroupId& grpId)
|
||||
{
|
||||
RsGxsChannelGroup distant_group;
|
||||
|
||||
if( rsGxsChannels->retrieveDistantGroup(grpId,distant_group)) // normally we should also check that the group meta is not already here.
|
||||
{
|
||||
std::cerr << "GxsChannelDialog::checkRequestGroup() sending turtle request for group data for group " << grpId << std::endl;
|
||||
rsGxsChannels->turtleGroupRequest(grpId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,6 +50,10 @@ protected:
|
|||
virtual GroupFrameSettings::Type groupFrameSettingsType() { return GroupFrameSettings::Channel; }
|
||||
virtual QString getHelpString() const ;
|
||||
virtual void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata);
|
||||
virtual bool getDistantSearchResults(TurtleRequestId id, std::map<RsGxsGroupId,RsGxsGroupSummary>& group_infos);
|
||||
|
||||
virtual TurtleRequestId distantSearch(const QString& search_string) ;
|
||||
virtual void checkRequestGroup(const RsGxsGroupId& grpId) ;
|
||||
|
||||
private slots:
|
||||
void toggleAutoDownload();
|
||||
|
|
|
@ -596,6 +596,20 @@ void GxsChannelPostsWidget::clearPosts()
|
|||
ui->fileWidget->clear();
|
||||
}
|
||||
|
||||
void GxsChannelPostsWidget::blank()
|
||||
{
|
||||
mStateHelper->setWidgetEnabled(ui->postButton, false);
|
||||
mStateHelper->setWidgetEnabled(ui->subscribeToolButton, false);
|
||||
|
||||
clearPosts();
|
||||
|
||||
groupNameChanged(QString());
|
||||
|
||||
ui->infoWidget->hide();
|
||||
ui->feedWidget->show();
|
||||
ui->fileWidget->hide();
|
||||
}
|
||||
|
||||
bool GxsChannelPostsWidget::navigatePostItem(const RsGxsMessageId &msgId)
|
||||
{
|
||||
FeedItem *feedItem = ui->feedWidget->findGxsFeedItem(groupId(), msgId);
|
||||
|
@ -643,12 +657,22 @@ bool GxsChannelPostsWidget::insertGroupData(const uint32_t &token, RsGroupMetaDa
|
|||
std::vector<RsGxsChannelGroup> groups;
|
||||
rsGxsChannels->getGroupData(token, groups);
|
||||
|
||||
if (groups.size() == 1)
|
||||
if(groups.size() == 1)
|
||||
{
|
||||
insertChannelDetails(groups[0]);
|
||||
metaData = groups[0].mMeta;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
RsGxsChannelGroup distant_group;
|
||||
if(rsGxsChannels->retrieveDistantGroup(groupId(),distant_group))
|
||||
{
|
||||
insertChannelDetails(distant_group);
|
||||
metaData = distant_group.mMeta;
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -73,6 +73,7 @@ protected:
|
|||
virtual bool useThread() { return mUseThread; }
|
||||
virtual void fillThreadCreatePost(const QVariant &post, bool related, int current, int count);
|
||||
virtual bool navigatePostItem(const RsGxsMessageId& msgId);
|
||||
virtual void blank() ;
|
||||
|
||||
/* GxsMessageFrameWidget */
|
||||
virtual void setAllMessagesReadDo(bool read, uint32_t &token);
|
||||
|
|
|
@ -299,6 +299,28 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
|
|||
|
||||
}
|
||||
|
||||
void GxsForumThreadWidget::blank()
|
||||
{
|
||||
ui->progressBar->hide();
|
||||
ui->progressText->hide();
|
||||
ui->postText->clear() ;
|
||||
ui->by_label->setId(RsGxsId()) ;
|
||||
ui->time_label->clear();
|
||||
ui->lineRight->hide();
|
||||
ui->lineLeft->hide();
|
||||
ui->by_text_label->hide();
|
||||
ui->by_label->hide();
|
||||
ui->postText->setImageBlockWidget(ui->imageBlockWidget) ;
|
||||
ui->postText->resetImagesStatus(Settings->getForumLoadEmbeddedImages());
|
||||
ui->threadTreeWidget->clear();
|
||||
ui->forumName->setText("");
|
||||
|
||||
mStateHelper->setWidgetEnabled(ui->newthreadButton, false);
|
||||
mStateHelper->setWidgetEnabled(ui->previousButton, false);
|
||||
mStateHelper->setWidgetEnabled(ui->nextButton, false);
|
||||
ui->versions_CB->hide();
|
||||
}
|
||||
|
||||
GxsForumThreadWidget::~GxsForumThreadWidget()
|
||||
{
|
||||
if (mFillThread) {
|
||||
|
|
|
@ -58,6 +58,7 @@ public:
|
|||
|
||||
// Callback for all Loads.
|
||||
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
virtual void blank();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
|
|
|
@ -114,17 +114,17 @@ void GxsForumsFillThread::run()
|
|||
service->requestMsgInfo(msg_token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds);
|
||||
|
||||
/* wait for the answer */
|
||||
uint32_t requestStatus = RsTokenService::GXS_REQUEST_V2_STATUS_PENDING;
|
||||
uint32_t requestStatus = RsTokenService::PENDING;
|
||||
while (!wasStopped()) {
|
||||
requestStatus = service->requestStatus(msg_token);
|
||||
if (requestStatus == RsTokenService::GXS_REQUEST_V2_STATUS_FAILED ||
|
||||
requestStatus == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) {
|
||||
if (requestStatus == RsTokenService::FAILED ||
|
||||
requestStatus == RsTokenService::COMPLETE) {
|
||||
break;
|
||||
}
|
||||
msleep(200);
|
||||
}
|
||||
|
||||
if (requestStatus == RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
if (requestStatus == RsTokenService::FAILED)
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -143,17 +143,17 @@ void GxsForumsFillThread::run()
|
|||
service->requestGroupInfo(grp_token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds);
|
||||
|
||||
/* wait for the answer */
|
||||
uint32_t requestStatus = RsTokenService::GXS_REQUEST_V2_STATUS_PENDING;
|
||||
uint32_t requestStatus = RsTokenService::PENDING;
|
||||
while (!wasStopped()) {
|
||||
requestStatus = service->requestStatus(grp_token);
|
||||
if (requestStatus == RsTokenService::GXS_REQUEST_V2_STATUS_FAILED ||
|
||||
requestStatus == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE) {
|
||||
if (requestStatus == RsTokenService::FAILED ||
|
||||
requestStatus == RsTokenService::COMPLETE) {
|
||||
break;
|
||||
}
|
||||
msleep(200);
|
||||
}
|
||||
|
||||
if (requestStatus == RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
if (requestStatus == RsTokenService::FAILED)
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -221,11 +221,11 @@ void GxsForumsFillThread::run()
|
|||
// and tries to establish parenthood relationships between them, given that we only know the
|
||||
// immediate parent of a message and now its children. Some messages have a missing parent and for them
|
||||
// a fake top level parent is generated.
|
||||
|
||||
|
||||
// In order to be efficient, we first create a structure that lists the children of every mesage ID in the list.
|
||||
// Then the hierarchy of message is build by attaching the kids to every message until all of them have been processed.
|
||||
// The messages with missing parents will be the last ones remaining in the list.
|
||||
|
||||
|
||||
std::list<std::pair< RsGxsMessageId, QTreeWidgetItem* > > threadStack;
|
||||
std::map<RsGxsMessageId,std::list<RsGxsMessageId> > kids_array ;
|
||||
std::set<RsGxsMessageId> missing_parents;
|
||||
|
@ -333,7 +333,7 @@ void GxsForumsFillThread::run()
|
|||
|
||||
// The next step is to find the top level thread messages. These are defined as the messages without
|
||||
// any parent message ID.
|
||||
|
||||
|
||||
// this trick is needed because while we remove messages, the parents a given msg may already have been removed
|
||||
// and wrongly understand as a missing parent.
|
||||
|
||||
|
@ -434,7 +434,7 @@ void GxsForumsFillThread::run()
|
|||
{
|
||||
// We iterate through the top level thread items, and look for which message has the current item as parent.
|
||||
// When found, the item is put in the thread list itself, as a potential new parent.
|
||||
|
||||
|
||||
std::map<RsGxsMessageId,RsGxsForumMsg>::iterator mit = msgs.find(*it2) ;
|
||||
|
||||
if(mit == msgs.end())
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <QFile>
|
||||
#include <QDesktopServices>
|
||||
#include "gui/common/vmessagebox.h"
|
||||
#include "gui/common/html.h"
|
||||
#include "gui/common/rshtml.h"
|
||||
#include <rshare.h>
|
||||
|
||||
#include "helptextbrowser.h"
|
||||
|
|
|
@ -241,5 +241,6 @@
|
|||
<file>icons/warning_yellow_128.png</file>
|
||||
<file>icons/yahoo.png</file>
|
||||
<file>icons/yandex.png</file>
|
||||
<file>icons/png/markdown-mark.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
BIN
retroshare-gui/src/gui/icons/png/markdown-mark.png
Normal file
BIN
retroshare-gui/src/gui/icons/png/markdown-mark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.5 KiB |
|
@ -28,6 +28,7 @@
|
|||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <QTextCodec>
|
||||
#include <QDesktopServices>
|
||||
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/RetroShareLink.h"
|
||||
|
@ -756,18 +757,19 @@ void MessageWidget::anchorClicked(const QUrl &url)
|
|||
{
|
||||
RetroShareLink link(url);
|
||||
|
||||
if (link.valid() == false) {
|
||||
return;
|
||||
if(link.valid())
|
||||
{
|
||||
if (link.type() == RetroShareLink::TYPE_CERTIFICATE && currMsgFlags & RS_MSG_USER_REQUEST) {
|
||||
std::cerr << "(WW) Calling some disabled code in MessageWidget::anchorClicked(). Please contact the developpers." << std::endl;
|
||||
// link.setSubType(RSLINK_SUBTYPE_CERTIFICATE_USER_REQUEST);
|
||||
}
|
||||
|
||||
QList<RetroShareLink> links;
|
||||
links.append(link);
|
||||
RetroShareLink::process(links);
|
||||
}
|
||||
|
||||
if (link.type() == RetroShareLink::TYPE_CERTIFICATE && currMsgFlags & RS_MSG_USER_REQUEST) {
|
||||
std::cerr << "(WW) Calling some disabled code in MessageWidget::anchorClicked(). Please contact the developpers." << std::endl;
|
||||
// link.setSubType(RSLINK_SUBTYPE_CERTIFICATE_USER_REQUEST);
|
||||
}
|
||||
|
||||
QList<RetroShareLink> links;
|
||||
links.append(link);
|
||||
RetroShareLink::process(links);
|
||||
else
|
||||
QDesktopServices::openUrl(url) ;
|
||||
}
|
||||
|
||||
void MessageWidget::loadImagesAlways()
|
||||
|
|
|
@ -563,7 +563,12 @@ void NotifyQt::notifyChatCleared(const ChatId& chat_id)
|
|||
emit chatCleared(chat_id);
|
||||
}
|
||||
|
||||
void NotifyQt::notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& files)
|
||||
void NotifyQt::notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleGxsInfo>& found_groups)
|
||||
{
|
||||
std::cerr << "(EE) missing code to handle GXS turtle search result." << std::endl;
|
||||
}
|
||||
|
||||
void NotifyQt::notifyTurtleSearchResult(const RsPeerId& pid,uint32_t search_id,const std::list<TurtleFileInfo>& files)
|
||||
{
|
||||
{
|
||||
QMutexLocker m(&_mutex) ;
|
||||
|
@ -583,7 +588,7 @@ void NotifyQt::notifyTurtleSearchResult(uint32_t search_id,const std::list<Turtl
|
|||
det.name = (*it).name ;
|
||||
det.hash = (*it).hash ;
|
||||
det.size = (*it).size ;
|
||||
det.id.clear() ;
|
||||
det.id = pid ;
|
||||
|
||||
emit gotTurtleSearchResult(search_id,det) ;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,9 @@ class MessengerWindow;
|
|||
class ToasterItem;
|
||||
class ToasterNotify;
|
||||
class SignatureEventData ;
|
||||
|
||||
struct TurtleFileInfo;
|
||||
struct TurtleGxsInfo;
|
||||
|
||||
class NotifyQt: public QObject, public NotifyClient
|
||||
{
|
||||
|
@ -46,7 +48,8 @@ class NotifyQt: public QObject, public NotifyClient
|
|||
virtual void notifyChatCleared(const ChatId &chat_id);
|
||||
virtual void notifyCustomState(const std::string& peer_id, const std::string& status_string);
|
||||
virtual void notifyHashingInfo(uint32_t type, const std::string& fileinfo);
|
||||
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& found_files);
|
||||
virtual void notifyTurtleSearchResult(const RsPeerId &pid, uint32_t search_id, const std::list<TurtleFileInfo>& found_files);
|
||||
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleGxsInfo>& found_groups);
|
||||
virtual void notifyPeerHasNewAvatar(std::string peer_id) ;
|
||||
virtual void notifyOwnAvatarChanged() ;
|
||||
virtual void notifyChatLobbyEvent(uint64_t /* lobby id */, uint32_t /* event type */, const RsGxsId & /*nickname*/, const std::string& /* any string */) ;
|
||||
|
|
|
@ -186,7 +186,7 @@ ChatLobbyDialog QListWidget#participantsList {
|
|||
background: white;
|
||||
}
|
||||
|
||||
CreateLobbyDialog QFrame#lobbyFrame {
|
||||
CreateLobbyDialog QFrame#roomFrame {
|
||||
border: 2px solid #CCCCCC;
|
||||
border-radius:6px;
|
||||
background: white;
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#include "../MainWindow.h"
|
||||
|
||||
PluginsPage::PluginsPage(QWidget * parent, Qt::WindowFlags flags)
|
||||
settings::PluginsPage::PluginsPage(QWidget * parent, Qt::WindowFlags flags)
|
||||
: ConfigPage(parent, flags)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
@ -123,7 +123,7 @@ PluginsPage::PluginsPage(QWidget * parent, Qt::WindowFlags flags)
|
|||
|
||||
if(plugin == NULL || plugin->qt_config_panel() == NULL)
|
||||
item->_configure_PB->hide() ;
|
||||
|
||||
|
||||
|
||||
if(plugin != NULL){
|
||||
item->enableButton->hide();
|
||||
|
@ -159,7 +159,7 @@ PluginsPage::PluginsPage(QWidget * parent, Qt::WindowFlags flags)
|
|||
|
||||
QObject::connect(ui.enableAll,SIGNAL(toggled(bool)),this,SLOT(toggleEnableAll(bool))) ;
|
||||
}
|
||||
QString PluginsPage::helpText() const
|
||||
QString settings::PluginsPage::helpText() const
|
||||
{
|
||||
return tr("<h1><img width=\"24\" src=\":/icons/help_64.png\"> Plugins</h1> \
|
||||
<p>Plugins are loaded from the directories listed in the bottom list.</p> \
|
||||
|
@ -171,11 +171,11 @@ QString PluginsPage::helpText() const
|
|||
<p>If you want to develop your own plugins, contact the developpers team \
|
||||
they will be happy to help you out!</p>") ;
|
||||
}
|
||||
void PluginsPage::toggleEnableAll(bool b)
|
||||
void settings::PluginsPage::toggleEnableAll(bool b)
|
||||
{
|
||||
rsPlugins->allowAllPlugins(b) ;
|
||||
}
|
||||
void PluginsPage::aboutPlugin(int i)
|
||||
void settings::PluginsPage::aboutPlugin(int i)
|
||||
{
|
||||
std::cerr << "Launching about window for plugin " << i << std::endl;
|
||||
|
||||
|
@ -183,7 +183,7 @@ void PluginsPage::aboutPlugin(int i)
|
|||
if(rsPlugins->plugin(i) != NULL && (dialog = rsPlugins->plugin(i)->qt_about_page()) != NULL)
|
||||
dialog->exec() ;
|
||||
}
|
||||
void PluginsPage::configurePlugin(int i)
|
||||
void settings::PluginsPage::configurePlugin(int i)
|
||||
{
|
||||
std::cerr << "Launching configuration window for plugin " << i << std::endl;
|
||||
|
||||
|
@ -191,14 +191,14 @@ void PluginsPage::configurePlugin(int i)
|
|||
rsPlugins->plugin(i)->qt_config_panel()->show() ;
|
||||
}
|
||||
|
||||
void PluginsPage::enablePlugin(const QString& hash)
|
||||
void settings::PluginsPage::enablePlugin(const QString& hash)
|
||||
{
|
||||
std::cerr << "Switching status of plugin " << hash.toStdString() << " to enable" << std::endl;
|
||||
|
||||
rsPlugins->enablePlugin(RsFileHash(hash.toStdString()) );
|
||||
}
|
||||
|
||||
void PluginsPage::disablePlugin(const QString& hash)
|
||||
void settings::PluginsPage::disablePlugin(const QString& hash)
|
||||
{
|
||||
std::cerr << "Switching status of plugin " << hash.toStdString() << " to disable " << std::endl;
|
||||
|
||||
|
@ -206,11 +206,11 @@ void PluginsPage::disablePlugin(const QString& hash)
|
|||
}
|
||||
|
||||
|
||||
PluginsPage::~PluginsPage()
|
||||
settings::PluginsPage::~PluginsPage()
|
||||
{
|
||||
}
|
||||
|
||||
/** Loads the settings for this page */
|
||||
void PluginsPage::load()
|
||||
void settings::PluginsPage::load()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <retroshare-gui/configpage.h>
|
||||
#include "ui_PluginsPage.h"
|
||||
|
||||
namespace settings {
|
||||
|
||||
class PluginsPage : public ConfigPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -52,3 +54,4 @@ class PluginsPage : public ConfigPage
|
|||
Ui::PluginsPage ui;
|
||||
};
|
||||
|
||||
} // namespace settings
|
||||
|
|
|
@ -29,11 +29,12 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
#include <retroshare/rsbanlist.h>
|
||||
#include <retroshare/rsconfig.h>
|
||||
#include <retroshare/rsdht.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsturtle.h>
|
||||
#include "retroshare/rsbanlist.h"
|
||||
#include "retroshare/rsconfig.h"
|
||||
#include "retroshare/rsdht.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "retroshare/rsturtle.h"
|
||||
#include "retroshare/rsinit.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QMovie>
|
||||
|
@ -62,23 +63,14 @@
|
|||
///
|
||||
|
||||
// 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_HIDDEN_SERVICE_INCOMING = 1;
|
||||
const static uint32_t TAB_HIDDEN_SERVICE_I2P_BOB = 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_HIDDEN_SERVICE = 1;
|
||||
const static uint32_t TAB_IP_FILTERS = 2;
|
||||
const static uint32_t TAB_RELAYS = 3;
|
||||
#endif
|
||||
|
||||
//#define SERVER_DEBUG 1
|
||||
|
||||
|
@ -90,13 +82,15 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
|
|||
|
||||
manager = NULL ;
|
||||
|
||||
#ifdef RETROTOR
|
||||
if(RsAccounts::isTorAuto())
|
||||
{
|
||||
// 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.tabWidget->removeTab(TAB_RELAYS) ; // remove relays. Not useful in Tor mode.
|
||||
ui.tabWidget->removeTab(TAB_IP_FILTERS) ; // remove IP filters. Not useful in Tor mode.
|
||||
|
||||
ui.hiddenServiceTab->removeTab(TAB_HIDDEN_SERVICE_I2P_BOB) ; // remove the Automatic I2P/BOB tab
|
||||
|
||||
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() ;
|
||||
|
@ -109,7 +103,8 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
|
|||
|
||||
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"))) ;
|
||||
|
@ -137,7 +132,6 @@ 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(TAB_HIDDEN_SERVICE_INCOMING, false);
|
||||
ui.gbBob->setEnabled(false);
|
||||
ui.swBobAdvanced->setCurrentIndex(0);
|
||||
|
||||
|
@ -197,7 +191,6 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
|
|||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
|
||||
connect(ui.discComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(saveAddresses()));
|
||||
connect(ui.netModeComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(saveAddresses()));
|
||||
connect(ui.localAddress, SIGNAL(textChanged(QString)),this,SLOT(saveAddresses()));
|
||||
|
@ -237,6 +230,10 @@ 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()));
|
||||
|
||||
// when the network menu is opened and the hidden service tab is already selected updateOutProxyIndicator() won't be called and thus resulting in wrong proxy indicators.
|
||||
if (ui.tabWidget->currentIndex() == TAB_HIDDEN_SERVICE)
|
||||
updateOutProxyIndicator();
|
||||
}
|
||||
|
||||
void ServerPage::saveAndTestInProxy()
|
||||
|
@ -340,8 +337,8 @@ void ServerPage::load()
|
|||
if (mIsHiddenNode)
|
||||
{
|
||||
mHiddenType = detail.hiddenType;
|
||||
ui.tabWidget->setTabEnabled(TAB_IP_FILTERS,false) ; // ip filter
|
||||
ui.tabWidget->setTabEnabled(TAB_RELAYS,false) ; // relay
|
||||
//ui.tabWidget->setTabEnabled(TAB_IP_FILTERS,false) ; // ip filter
|
||||
//ui.tabWidget->setTabEnabled(TAB_RELAYS,false) ; // relay
|
||||
loadHiddenNode();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabNetConf">
|
||||
<attribute name="title">
|
||||
|
@ -525,277 +525,6 @@ behind a firewall or a VPN.</string>
|
|||
<zorder>IPServersLV</zorder>
|
||||
<zorder>ipAddressList</zorder>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabIPFilters">
|
||||
<attribute name="title">
|
||||
<string>IP Filters</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="tabIPFiltersVLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="denyAll_CB">
|
||||
<property name="text">
|
||||
<string>Activate IP filtering</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="ipTabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="ipBlackListTabWidget">
|
||||
<attribute name="title">
|
||||
<string>IP blacklist</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="ipBlackListTabWidgetVLayout">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="filteredIpsTable">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>This list gets automatically filled with information gathered at multiple sources: masquerading peers reported by the DHT, IP ranges entered by you, and IP ranges reported by your friends. Default settings should protect you against large scale traffic relaying.</p><p>Automatically guessing masquerading IPs can put your friends IPs in the blacklist. In this case, use the context menu to whitelist them.</p></body></html></string>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>IP range</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Status</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Origin</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Reason</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Comment</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="includeFromFriends_CB">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>This is very drastic, be careful. Since masquerading IPs might be actual real IPs, this option might cause disconnection, and will probably force you to add your friends' IPs into the whitelist.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ban every IP reported by your friends</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="includeFromDHT_CB">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Another drastic option. If you use it, be prepared to add your friends' IPs into the whitelist when needed.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ban every masquerading IP reported by your DHT</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="groupIPRangesHLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="groupIPRanges_CB">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>If used alone, this option protects you quite well from large scale IP masquerading.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Automatically ban ranges of DHT masquerading IPs starting at</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="groupIPRanges_SB">
|
||||
<property name="suffix">
|
||||
<string> IPs</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="groupIPRangesHSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="ipWhiteListTabWidget">
|
||||
<attribute name="title">
|
||||
<string>IP whitelist</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="ipWhiteListTabWidgetGLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTableWidget" name="whiteListIpsTable">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>White listed IPs are gathered from the following sources: IPs coming inside a manually exchanged certificate, IP ranges entered by you in this window, or in the security feed items.</p><p>The default behavior for Retroshare is to (1) always allow connection to peers with IP in the whitelist, even if that IP is also blacklisted; (2) optionally require IPs to be in the whitelist. You can change this behavior for each peer in the &quot;Details&quot; window of each Retroshare node. </p></body></html></string>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>IP range</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Status</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Origin</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Reason</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Comment</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="manualInputGBox">
|
||||
<property name="title">
|
||||
<string>Manual input</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="manualInputGBoxVLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="ipinputHLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="ipInput_LE">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Enter an IP range. Accepted formats:</p><p>193.190.209.15</p><p>193.190.209.15/24</p><p>193.190.209.15/16</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="ipInputRange_SB">
|
||||
<property name="minimum">
|
||||
<number>16</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>32</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>24</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="ipInputComment_LE">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Enter any comment you'd like</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="ipInputAddBlackList_PB">
|
||||
<property name="text">
|
||||
<string>Add to blacklist</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="ipInputAddWhiteList_PB">
|
||||
<property name="text">
|
||||
<string>Add to whitelist</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="manualInputVSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabHiddenConf">
|
||||
<attribute name="title">
|
||||
<string>Hidden Service Configuration</string>
|
||||
|
@ -810,7 +539,7 @@ behind a firewall or a VPN.</string>
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="hiddenServiceTabManual">
|
||||
<attribute name="title">
|
||||
|
@ -981,6 +710,204 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="hiddenServiceTabIncoming">
|
||||
<attribute name="title">
|
||||
<string>Incoming</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="hiddenServiceTabIncomingVLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="hiddenpage_inHeader">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Setup your hidden address (and port if needed)</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="incomingAddressGLayout">
|
||||
<item row="0" column="2">
|
||||
<widget class="QSpinBox" name="hiddenpage_localPort">
|
||||
<property name="minimum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<layout class="QHBoxLayout" name="testIncomingHLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="testIncoming_PB">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>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 &quot;security warning&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.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Test</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QSpinBox" name="hiddenpage_servicePort">
|
||||
<property name="minimum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="l_serviceAddress">
|
||||
<property name="text">
|
||||
<string>Service Address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="l_localAddress">
|
||||
<property name="text">
|
||||
<string>Local Address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="hiddenpage_serviceAddress">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>This is your hidden address. It should look like <span style=" font-weight:600;">[something].onion</span> or <span style=" font-weight:600;">[something].b32.i2p. </span>If you configured a hidden service with Tor, the onion address is generated automatically by Tor. You can get it in e.g. <span style=" font-weight:600;">/var/lib/tor/[service name]/hostname</span>. For I2P: Setup a server tunnel ( http://127.0.0.1:7657/i2ptunnelmgr ) and copy it's base32 address when it is started (should end with .b32.i2p)</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="hiddenpage_localAddress">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>This is the local address to which the hidden service points at your localhost. Most of the time, <span style=" font-weight:600;">127.0.0.1</span> is the right answer.</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<layout class="QHBoxLayout" name="serviceIncomingHLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="iconlabel_service_incoming">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/ledoff1.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="l_incomingTestResult">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>This led turns green only if you launch an active test using the above button. </p><p>When it does, it means that your hidden node can be reached from anywhere, using the Tor (resp. I2P) </p><p>network. Congratulations!</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>incoming ok</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="hiddenpage_configurationVLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="l_hiddenpage_configuration">
|
||||
<property name="text">
|
||||
<string>Expected Configuration:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="hiddenpage_configuration">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="plainText">
|
||||
<string>Please fill in a service address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="hiddenpageInHelpPlainTextEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="plainText">
|
||||
<string>To Receive Connections, you must first setup a Tor/I2P Hidden Service.
|
||||
|
||||
For Tor: See torrc and documentation for HOWTO details.
|
||||
|
||||
For I2P: See http://127.0.0.1:7657/i2ptunnelmgr for setting up a server tunnel:
|
||||
Tunnel Wizard -> Server Tunnel -> Standard -> enter a name -> enter the address and port your RS is using (see Local Address above) -> check 'Auto Start' -> finish!
|
||||
|
||||
Once this is done, paste the Onion/I2P (Base32) Address in the box above.
|
||||
This is your external address on the Tor/I2P network.
|
||||
Finally make sure that the Ports match the configuration.
|
||||
|
||||
If you have issues connecting over Tor check the Tor logs too.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="vspacerHiddenIn">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="hiddenServiceTabI2PBOB">
|
||||
<attribute name="title">
|
||||
<string>Automatic I2P/BOB</string>
|
||||
|
@ -1456,204 +1383,277 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="hiddenServiceTabIncoming">
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabIPFilters">
|
||||
<attribute name="title">
|
||||
<string>IP Filters</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="tabIPFiltersVLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="denyAll_CB">
|
||||
<property name="text">
|
||||
<string>Activate IP filtering</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="ipTabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="ipBlackListTabWidget">
|
||||
<attribute name="title">
|
||||
<string>Incoming</string>
|
||||
<string>IP blacklist</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="hiddenServiceTabIncomingVLayout">
|
||||
<layout class="QVBoxLayout" name="ipBlackListTabWidgetVLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="hiddenpage_inHeader">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Setup your hidden address (and port if needed)</p></body></html></string>
|
||||
<widget class="QTableWidget" name="filteredIpsTable">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="incomingAddressGLayout">
|
||||
<item row="0" column="2">
|
||||
<widget class="QSpinBox" name="hiddenpage_localPort">
|
||||
<property name="minimum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<layout class="QHBoxLayout" name="testIncomingHLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="testIncoming_PB">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>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 &quot;security warning&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.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Test</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QSpinBox" name="hiddenpage_servicePort">
|
||||
<property name="minimum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="l_serviceAddress">
|
||||
<property name="text">
|
||||
<string>Service Address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="l_localAddress">
|
||||
<property name="text">
|
||||
<string>Local Address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="hiddenpage_serviceAddress">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>This is your hidden address. It should look like <span style=" font-weight:600;">[something].onion</span> or <span style=" font-weight:600;">[something].b32.i2p. </span>If you configured a hidden service with Tor, the onion address is generated automatically by Tor. You can get it in e.g. <span style=" font-weight:600;">/var/lib/tor/[service name]/hostname</span>. For I2P: Setup a server tunnel ( http://127.0.0.1:7657/i2ptunnelmgr ) and copy it's base32 address when it is started (should end with .b32.i2p)</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="hiddenpage_localAddress">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>This is the local address to which the hidden service points at your localhost. Most of the time, <span style=" font-weight:600;">127.0.0.1</span> is the right answer.</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<layout class="QHBoxLayout" name="serviceIncomingHLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="iconlabel_service_incoming">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/ledoff1.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="l_incomingTestResult">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>This led turns green only if you launch an active test using the above button. </p><p>When it does, it means that your hidden node can be reached from anywhere, using the Tor (resp. I2P) </p><p>network. Congratulations!</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>incoming ok</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="hiddenpage_configurationVLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="l_hiddenpage_configuration">
|
||||
<property name="text">
|
||||
<string>Expected Configuration:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="hiddenpage_configuration">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="plainText">
|
||||
<string>Please fill in a service address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="hiddenpageInHelpPlainTextEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>This list gets automatically filled with information gathered at multiple sources: masquerading peers reported by the DHT, IP ranges entered by you, and IP ranges reported by your friends. Default settings should protect you against large scale traffic relaying.</p><p>Automatically guessing masquerading IPs can put your friends IPs in the blacklist. In this case, use the context menu to whitelist them.</p></body></html></string>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="plainText">
|
||||
<string>To Receive Connections, you must first setup a Tor/I2P Hidden Service.
|
||||
|
||||
For Tor: See torrc and documentation for HOWTO details.
|
||||
|
||||
For I2P: See http://127.0.0.1:7657/i2ptunnelmgr for setting up a server tunnel:
|
||||
Tunnel Wizard -> Server Tunnel -> Standard -> enter a name -> enter the address and port your RS is using (see Local Address above) -> check 'Auto Start' -> finish!
|
||||
|
||||
Once this is done, paste the Onion/I2P (Base32) Address in the box above.
|
||||
This is your external address on the Tor/I2P network.
|
||||
Finally make sure that the Ports match the configuration.
|
||||
|
||||
If you have issues connecting over Tor check the Tor logs too.</string>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>IP range</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Status</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Origin</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Reason</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Comment</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="includeFromFriends_CB">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>This is very drastic, be careful. Since masquerading IPs might be actual real IPs, this option might cause disconnection, and will probably force you to add your friends' IPs into the whitelist.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ban every IP reported by your friends</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="vspacerHiddenIn">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<widget class="QCheckBox" name="includeFromDHT_CB">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Another drastic option. If you use it, be prepared to add your friends' IPs into the whitelist when needed.</p></body></html></string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
<property name="text">
|
||||
<string>Ban every masquerading IP reported by your DHT</string>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="groupIPRangesHLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="groupIPRanges_CB">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>If used alone, this option protects you quite well from large scale IP masquerading.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Automatically ban ranges of DHT masquerading IPs starting at</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="groupIPRanges_SB">
|
||||
<property name="suffix">
|
||||
<string> IPs</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="groupIPRangesHSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="ipWhiteListTabWidget">
|
||||
<attribute name="title">
|
||||
<string>IP whitelist</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="ipWhiteListTabWidgetGLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTableWidget" name="whiteListIpsTable">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>White listed IPs are gathered from the following sources: IPs coming inside a manually exchanged certificate, IP ranges entered by you in this window, or in the security feed items.</p><p>The default behavior for Retroshare is to (1) always allow connection to peers with IP in the whitelist, even if that IP is also blacklisted; (2) optionally require IPs to be in the whitelist. You can change this behavior for each peer in the &quot;Details&quot; window of each Retroshare node. </p></body></html></string>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>IP range</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Status</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Origin</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Reason</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Comment</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="manualInputGBox">
|
||||
<property name="title">
|
||||
<string>Manual input</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="manualInputGBoxVLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="ipinputHLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="ipInput_LE">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Enter an IP range. Accepted formats:</p><p>193.190.209.15</p><p>193.190.209.15/24</p><p>193.190.209.15/16</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="ipInputRange_SB">
|
||||
<property name="minimum">
|
||||
<number>16</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>32</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>24</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="ipInputComment_LE">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Enter any comment you'd like</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="ipInputAddBlackList_PB">
|
||||
<property name="text">
|
||||
<string>Add to blacklist</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="ipInputAddWhiteList_PB">
|
||||
<property name="text">
|
||||
<string>Add to whitelist</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="manualInputVSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -447,6 +447,13 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="text">
|
||||
<string>Trust friend nodes with banned files</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textEdit">
|
||||
<property name="readOnly">
|
||||
|
|
|
@ -22,6 +22,9 @@ resource_api::ApiServerMHD* WebuiPage::apiServerMHD = 0;
|
|||
resource_api::ApiServerLocal* WebuiPage::apiServerLocal = 0;
|
||||
#endif
|
||||
resource_api::RsControlModule* WebuiPage::controlModule = 0;
|
||||
#ifdef RS_JSONAPI
|
||||
JsonApiServer* WebuiPage::jsonApiServer = nullptr;
|
||||
#endif
|
||||
|
||||
WebuiPage::WebuiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/)
|
||||
{
|
||||
|
@ -105,6 +108,11 @@ QString WebuiPage::helpText() const
|
|||
// TODO: LIBRESAPI_LOCAL_SERVER Move in appropriate place
|
||||
#ifdef LIBRESAPI_LOCAL_SERVER
|
||||
apiServerLocal = new resource_api::ApiServerLocal(apiServer, resource_api::ApiServerLocal::serverPath());
|
||||
#endif
|
||||
#ifdef RS_JSONAPI
|
||||
// Use same port of libresapi + 2
|
||||
jsonApiServer = new JsonApiServer(Settings->getWebinterfacePort() + 2);
|
||||
jsonApiServer->start("WebuiPage::jsonApiServer");
|
||||
#endif
|
||||
return ok;
|
||||
}
|
||||
|
@ -126,6 +134,10 @@ QString WebuiPage::helpText() const
|
|||
delete controlModule;
|
||||
controlModule = 0;
|
||||
}
|
||||
#ifdef RS_JSONAPI
|
||||
delete jsonApiServer;
|
||||
jsonApiServer = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*static*/ void WebuiPage::showWebui()
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
#include <retroshare-gui/configpage.h>
|
||||
#include "ui_WebuiPage.h"
|
||||
|
||||
#ifdef RS_JSONAPI
|
||||
# include "jsonapi/jsonapi.h"
|
||||
#endif
|
||||
|
||||
namespace resource_api{
|
||||
class ApiServer;
|
||||
class ApiServerMHD;
|
||||
|
@ -55,4 +59,7 @@ private:
|
|||
static resource_api::ApiServerLocal* apiServerLocal;
|
||||
#endif
|
||||
static resource_api::RsControlModule* controlModule;
|
||||
#ifdef RS_JSONAPI
|
||||
static JsonApiServer* jsonApiServer;
|
||||
#endif
|
||||
};
|
||||
|
|
|
@ -158,7 +158,7 @@ SettingsPage::initStackedWidget()
|
|||
addPage(new ForumPage()); // FORUMS
|
||||
addPage(new PostedPage()); // POSTED RENAME TO LINKS
|
||||
addPage(new NotifyPage()); // NOTIFY
|
||||
addPage(new PluginsPage() ); // PLUGINS
|
||||
addPage(new settings::PluginsPage() ); // PLUGINS
|
||||
addPage(new AppearancePage()); // APPEARENCE
|
||||
addPage(new SoundPage() ); // SOUND
|
||||
addPage(new ServicePermissionsPage() ); // PERMISSIONS
|
||||
|
|
|
@ -187,9 +187,7 @@ 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);
|
||||
|
|
|
@ -117,7 +117,7 @@ void BandwidthStatsWidget::updateComboBoxes()
|
|||
{
|
||||
if(*it != ui.service_CB->itemData(indx).toInt())
|
||||
{
|
||||
QString sname = QString::fromUtf8(service_info_map.mServiceList[ ((*it)<<8) + 0x02000000].mServiceName.c_str()) ;
|
||||
QString sname = QString::fromUtf8(service_info_map.mServiceList[RsServiceInfo::RsServiceInfoUIn16ToFullServiceId(*it)].mServiceName.c_str()) ;
|
||||
|
||||
if(ui.service_CB->count() <= indx)
|
||||
ui.service_CB->addItem(sname + " (0x"+QString::number(*it,16)+")",QVariant(*it)) ;
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
#include <QObject>
|
||||
#include <util/rsprint.h>
|
||||
#include <retroshare/rsturtle.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsgxstunnel.h>
|
||||
#include <retroshare/rsservicecontrol.h>
|
||||
#include <retroshare/rsidentity.h>
|
||||
#include <retroshare/rsgxsdistsync.h>
|
||||
#include "TurtleRouterDialog.h"
|
||||
#include <QPainter>
|
||||
#include <QStylePainter>
|
||||
#include <algorithm> // for sort
|
||||
#include <time.h>
|
||||
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
|
||||
|
@ -240,19 +245,14 @@ QTreeWidgetItem *TurtleRouterDialog::findParentHashItem(const std::string& hash)
|
|||
else
|
||||
return items.front() ;
|
||||
}
|
||||
|
||||
//=======================================================================================================================//
|
||||
|
||||
|
||||
GxsTunnelsDialog::GxsTunnelsDialog(QWidget *parent)
|
||||
TunnelStatisticsDialog::TunnelStatisticsDialog(QWidget *parent)
|
||||
: RsAutoUpdatePage(2000,parent)
|
||||
{
|
||||
// setupUi(this) ;
|
||||
|
||||
m_bProcessSettings = false;
|
||||
|
||||
//float fontHeight = QFontMetricsF(font()).height();
|
||||
//float fact = fontHeight/14.0;
|
||||
|
||||
maxWidth = 200 ;
|
||||
maxHeight = 200 ;
|
||||
|
||||
|
@ -260,14 +260,13 @@ GxsTunnelsDialog::GxsTunnelsDialog(QWidget *parent)
|
|||
processSettings(true);
|
||||
}
|
||||
|
||||
GxsTunnelsDialog::~GxsTunnelsDialog()
|
||||
TunnelStatisticsDialog::~TunnelStatisticsDialog()
|
||||
{
|
||||
|
||||
// save settings
|
||||
processSettings(false);
|
||||
}
|
||||
|
||||
void GxsTunnelsDialog::processSettings(bool bLoad)
|
||||
void TunnelStatisticsDialog::processSettings(bool bLoad)
|
||||
{
|
||||
m_bProcessSettings = true;
|
||||
|
||||
|
@ -284,7 +283,77 @@ void GxsTunnelsDialog::processSettings(bool bLoad)
|
|||
m_bProcessSettings = false;
|
||||
}
|
||||
|
||||
void GxsTunnelsDialog::updateDisplay()
|
||||
QString TunnelStatisticsDialog::getPeerName(const RsPeerId &peer_id)
|
||||
{
|
||||
static std::map<RsPeerId, QString> names ;
|
||||
|
||||
std::map<RsPeerId,QString>::const_iterator it = names.find(peer_id) ;
|
||||
|
||||
if( it != names.end())
|
||||
return it->second ;
|
||||
else
|
||||
{
|
||||
RsPeerDetails detail ;
|
||||
if(!rsPeers->getPeerDetails(peer_id,detail))
|
||||
return tr("Unknown Peer");
|
||||
|
||||
return (names[peer_id] = QString::fromUtf8(detail.name.c_str())) ;
|
||||
}
|
||||
}
|
||||
|
||||
QString TunnelStatisticsDialog::getPeerName(const RsGxsId& gxs_id)
|
||||
{
|
||||
static std::map<RsGxsId, QString> names ;
|
||||
|
||||
std::map<RsGxsId,QString>::const_iterator it = names.find(gxs_id) ;
|
||||
|
||||
if( it != names.end())
|
||||
return it->second ;
|
||||
else
|
||||
{
|
||||
RsIdentityDetails detail ;
|
||||
|
||||
if(!rsIdentity->getIdDetails(gxs_id,detail))
|
||||
return tr("Unknown Peer");
|
||||
|
||||
return (names[gxs_id] = QString::fromUtf8(detail.mNickname.c_str())) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QString TunnelStatisticsDialog::speedString(float f)
|
||||
{
|
||||
if(f < 1.0f)
|
||||
return QString("0 B/s") ;
|
||||
if(f < 1024.0f)
|
||||
return QString::number((int)f)+" B/s" ;
|
||||
|
||||
return QString::number(f/1024.0,'f',2) + " KB/s";
|
||||
}
|
||||
|
||||
void TunnelStatisticsDialog::paintEvent(QPaintEvent */*event*/)
|
||||
{
|
||||
QStylePainter(this).drawPixmap(0, 0, pixmap);
|
||||
}
|
||||
|
||||
void TunnelStatisticsDialog::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
QRect TaskGraphRect = geometry();
|
||||
|
||||
maxWidth = TaskGraphRect.width();
|
||||
maxHeight = TaskGraphRect.height() ;
|
||||
|
||||
QWidget::resizeEvent(event);
|
||||
update();
|
||||
}
|
||||
//=======================================================================================================================//
|
||||
|
||||
GxsAuthenticatedTunnelsDialog::GxsAuthenticatedTunnelsDialog(QWidget *parent)
|
||||
: TunnelStatisticsDialog(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void GxsAuthenticatedTunnelsDialog::updateDisplay()
|
||||
{
|
||||
// Request info about ongoing tunnels
|
||||
|
||||
|
@ -334,8 +403,8 @@ void GxsTunnelsDialog::updateDisplay()
|
|||
// draw...
|
||||
|
||||
painter.drawText(ox+4*cellx,oy+celly,tr("Tunnel ID: %1").arg(QString::fromStdString(tunnel_infos[i].tunnel_id.toStdString()))) ; oy += celly ;
|
||||
painter.drawText(ox+6*cellx,oy+celly,tr("from: %1").arg(QString::fromStdString(tunnel_infos[i].source_gxs_id.toStdString()))) ; oy += celly ;
|
||||
painter.drawText(ox+6*cellx,oy+celly,tr("to: %1").arg(QString::fromStdString(tunnel_infos[i].destination_gxs_id.toStdString()))) ; oy += celly ;
|
||||
painter.drawText(ox+6*cellx,oy+celly,tr("from: %1 (%2)").arg(QString::fromStdString(tunnel_infos[i].source_gxs_id.toStdString())).arg(getPeerName(tunnel_infos[i].source_gxs_id))) ; oy += celly ;
|
||||
painter.drawText(ox+6*cellx,oy+celly,tr("to: %1 (%2)").arg(QString::fromStdString(tunnel_infos[i].destination_gxs_id.toStdString())).arg(getPeerName(tunnel_infos[i].destination_gxs_id))) ; oy += celly ;
|
||||
painter.drawText(ox+6*cellx,oy+celly,tr("status: %1").arg(QString::number(tunnel_infos[i].tunnel_status))) ; oy += celly ;
|
||||
painter.drawText(ox+6*cellx,oy+celly,tr("total sent: %1 bytes").arg(QString::number(tunnel_infos[i].total_size_sent))) ; oy += celly ;
|
||||
painter.drawText(ox+6*cellx,oy+celly,tr("total recv: %1 bytes").arg(QString::number(tunnel_infos[i].total_size_received))) ; oy += celly ;
|
||||
|
@ -350,46 +419,197 @@ void GxsTunnelsDialog::updateDisplay()
|
|||
maxHeight = std::max(oy,10*celly);
|
||||
}
|
||||
|
||||
QString GxsTunnelsDialog::getPeerName(const RsPeerId &peer_id)
|
||||
//=======================================================================================================================//
|
||||
|
||||
GxsNetTunnelsDialog::GxsNetTunnelsDialog(QWidget *parent)
|
||||
: TunnelStatisticsDialog(parent)
|
||||
{
|
||||
static std::map<RsPeerId, QString> names ;
|
||||
}
|
||||
|
||||
std::map<RsPeerId,QString>::const_iterator it = names.find(peer_id) ;
|
||||
static QString getGroupStatusString(RsGxsNetTunnelGroupInfo::GroupStatus group_status)
|
||||
{
|
||||
switch(group_status)
|
||||
{
|
||||
default:
|
||||
case RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_UNKNOWN : return QObject::tr("Unknown") ;
|
||||
case RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE : return QObject::tr("Idle");
|
||||
case RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_STATUS_VPIDS_AVAILABLE : return QObject::tr("Virtual peers available");
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
if( it != names.end())
|
||||
return it->second ;
|
||||
else
|
||||
static QString getGroupPolicyString(RsGxsNetTunnelGroupInfo::GroupPolicy group_policy)
|
||||
{
|
||||
switch(group_policy)
|
||||
{
|
||||
default:
|
||||
case RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_UNKNOWN : return QObject::tr("Unknown") ;
|
||||
case RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE : return QObject::tr("Passive") ;
|
||||
case RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE : return QObject::tr("Active") ;
|
||||
case RsGxsNetTunnelGroupInfo::RS_GXS_NET_TUNNEL_GRP_POLICY_REQUESTING : return QObject::tr("Requesting peers") ;
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
static QString getLastContactString(time_t last_contact)
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
|
||||
if(last_contact == 0)
|
||||
return QObject::tr("Never");
|
||||
|
||||
return QString::number(now - last_contact) + " secs ago" ;
|
||||
}
|
||||
|
||||
static QString getServiceNameString(uint16_t service_id)
|
||||
{
|
||||
static RsPeerServiceInfo ownServices;
|
||||
|
||||
if(ownServices.mServiceList.find(service_id) == ownServices.mServiceList.end())
|
||||
rsServiceControl->getOwnServices(ownServices);
|
||||
|
||||
return QString::fromUtf8(ownServices.mServiceList[RsServiceInfo::RsServiceInfoUIn16ToFullServiceId(service_id)].mServiceName.c_str()) ;
|
||||
}
|
||||
|
||||
static QString getVirtualPeerStatusString(uint8_t status)
|
||||
{
|
||||
switch(status)
|
||||
{
|
||||
RsPeerDetails detail ;
|
||||
if(!rsPeers->getPeerDetails(peer_id,detail))
|
||||
return tr("Unknown Peer");
|
||||
|
||||
return (names[peer_id] = QString::fromUtf8(detail.name.c_str())) ;
|
||||
default:
|
||||
case RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN : return QObject::tr("Unknown") ;
|
||||
case RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_TUNNEL_OK : return QObject::tr("Tunnel OK") ;
|
||||
case RsGxsNetTunnelVirtualPeerInfo::RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE : return QObject::tr("Tunnel active") ;
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString GxsTunnelsDialog::speedString(float f)
|
||||
static QString getSideString(uint8_t side)
|
||||
{
|
||||
if(f < 1.0f)
|
||||
return QString("0 B/s") ;
|
||||
if(f < 1024.0f)
|
||||
return QString::number((int)f)+" B/s" ;
|
||||
|
||||
return QString::number(f/1024.0,'f',2) + " KB/s";
|
||||
return side?QObject::tr("Client"):QObject::tr("Server") ;
|
||||
}
|
||||
|
||||
void GxsTunnelsDialog::paintEvent(QPaintEvent */*event*/)
|
||||
static QString getMasterKeyString(const uint8_t *key,uint32_t size)
|
||||
{
|
||||
QStylePainter(this).drawPixmap(0, 0, pixmap);
|
||||
return QString::fromStdString(RsUtil::BinToHex(key,size,10));
|
||||
}
|
||||
|
||||
void GxsTunnelsDialog::resizeEvent(QResizeEvent *event)
|
||||
void GxsNetTunnelsDialog::updateDisplay()
|
||||
{
|
||||
QRect TaskGraphRect = geometry();
|
||||
|
||||
maxWidth = TaskGraphRect.width();
|
||||
maxHeight = TaskGraphRect.height() ;
|
||||
// Request info about ongoing tunnels
|
||||
|
||||
QWidget::resizeEvent(event);
|
||||
update();
|
||||
std::map<RsGxsGroupId,RsGxsNetTunnelGroupInfo> groups; // groups on the client and server side
|
||||
std::map<TurtleVirtualPeerId,RsGxsNetTunnelVirtualPeerId> turtle2gxsnettunnel; // convertion table from turtle to net tunnel virtual peer id
|
||||
std::map<RsGxsNetTunnelVirtualPeerId, RsGxsNetTunnelVirtualPeerInfo> virtual_peers; // current virtual peers, which group they provide, and how to talk to them through turtle
|
||||
Bias20Bytes bias;
|
||||
|
||||
rsGxsDistSync->getStatistics(groups,virtual_peers,turtle2gxsnettunnel,bias) ;
|
||||
|
||||
// RsGxsNetTunnelGroupInfo:
|
||||
//
|
||||
// enum GroupStatus {
|
||||
// RS_GXS_NET_TUNNEL_GRP_STATUS_UNKNOWN = 0x00, // unknown status
|
||||
// RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE = 0x01, // no virtual peers requested, just waiting
|
||||
// RS_GXS_NET_TUNNEL_GRP_STATUS_VPIDS_AVAILABLE = 0x02 // some virtual peers are available. Data can be read/written
|
||||
// };
|
||||
// enum GroupPolicy {
|
||||
// RS_GXS_NET_TUNNEL_GRP_POLICY_UNKNOWN = 0x00, // nothing has been set
|
||||
// RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE = 0x01, // group is available for server side tunnels, but does not explicitely request tunnels
|
||||
// RS_GXS_NET_TUNNEL_GRP_POLICY_ACTIVE = 0x02, // group will only explicitely request tunnels if none available
|
||||
// RS_GXS_NET_TUNNEL_GRP_POLICY_REQUESTING = 0x03, // group explicitely requests tunnels
|
||||
// };
|
||||
//
|
||||
// RsGxsNetTunnelGroupInfo() : group_policy(RS_GXS_NET_TUNNEL_GRP_POLICY_PASSIVE),group_status(RS_GXS_NET_TUNNEL_GRP_STATUS_IDLE),last_contact(0) {}
|
||||
//
|
||||
// GroupPolicy group_policy ;
|
||||
// GroupStatus group_status ;
|
||||
// time_t last_contact ;
|
||||
// RsFileHash hash ;
|
||||
// uint16_t service_id ;
|
||||
// std::set<RsPeerId> virtual_peers ;
|
||||
//
|
||||
// struct RsGxsNetTunnelVirtualPeerInfo:
|
||||
//
|
||||
// enum { RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN = 0x00, // unknown status.
|
||||
// RS_GXS_NET_TUNNEL_VP_STATUS_TUNNEL_OK = 0x01, // tunnel has been established and we're waiting for virtual peer id
|
||||
// RS_GXS_NET_TUNNEL_VP_STATUS_ACTIVE = 0x02 // virtual peer id is known. Data can transfer.
|
||||
// };
|
||||
//
|
||||
// RsGxsNetTunnelVirtualPeerInfo() : vpid_status(RS_GXS_NET_TUNNEL_VP_STATUS_UNKNOWN), last_contact(0),side(0) { memset(encryption_master_key,0,32) ; }
|
||||
// virtual ~RsGxsNetTunnelVirtualPeerInfo(){}
|
||||
//
|
||||
// uint8_t vpid_status ; // status of the peer
|
||||
// time_t last_contact ; // last time some data was sent/recvd
|
||||
// uint8_t side ; // client/server
|
||||
// uint8_t encryption_master_key[32];
|
||||
//
|
||||
// RsPeerId turtle_virtual_peer_id ; // turtle peer to use when sending data to this vpid.
|
||||
//
|
||||
// RsGxsGroupId group_id ; // group that virtual peer is providing
|
||||
// uint16_t service_id ; // this is used for checkng consistency of the incoming data
|
||||
|
||||
// update the pixmap
|
||||
//
|
||||
|
||||
// now draw the shit
|
||||
QPixmap tmppixmap(maxWidth, maxHeight);
|
||||
tmppixmap.fill(Qt::transparent);
|
||||
//setFixedHeight(maxHeight);
|
||||
|
||||
QPainter painter(&tmppixmap);
|
||||
painter.initFrom(this);
|
||||
|
||||
// extracts the height of the fonts in pixels. This is used to calibrate the size of the objects to draw.
|
||||
|
||||
float fontHeight = QFontMetricsF(font()).height();
|
||||
float fact = fontHeight/14.0;
|
||||
|
||||
int cellx = 6*fact ;
|
||||
int celly = (10+4)*fact ;
|
||||
int ox=5*fact,oy=5*fact ;
|
||||
|
||||
painter.setPen(QColor::fromRgb(0,0,0)) ;
|
||||
painter.drawText(ox+2*cellx,oy+celly,tr("Random Bias: %1").arg(getMasterKeyString(bias.toByteArray(),20))) ; oy += celly ;
|
||||
painter.drawText(ox+2*cellx,oy+celly,tr("GXS Groups:")) ; oy += celly ;
|
||||
|
||||
for(auto it(groups.begin());it!=groups.end();++it)
|
||||
{
|
||||
painter.drawText(ox+4*cellx,oy+celly,tr("Service: %1 (%2) - Group ID: %3,\t policy: %4, \tstatus: %5, \tlast contact: %6")
|
||||
.arg("0x" + QString::number(it->second.service_id, 16))
|
||||
.arg(getServiceNameString(it->second.service_id))
|
||||
.arg(QString::fromStdString(it->first.toStdString()))
|
||||
.arg(getGroupPolicyString(it->second.group_policy))
|
||||
.arg(getGroupStatusString(it->second.group_status))
|
||||
.arg(getLastContactString(it->second.last_contact))
|
||||
),oy+=celly ;
|
||||
|
||||
|
||||
for(auto it2(it->second.virtual_peers.begin());it2!=it->second.virtual_peers.end();++it2)
|
||||
{
|
||||
auto it4 = turtle2gxsnettunnel.find(*it2) ;
|
||||
|
||||
if(it4 != turtle2gxsnettunnel.end())
|
||||
{
|
||||
auto it3 = virtual_peers.find(it4->second) ;
|
||||
|
||||
if(virtual_peers.end() != it3)
|
||||
painter.drawText(ox+6*cellx,oy+celly,tr("Peer: %1:\tstatus: %2/%3, \tlast contact: %4, \tMaster key: %5.")
|
||||
.arg(QString::fromStdString((*it2).toStdString()))
|
||||
.arg(getVirtualPeerStatusString(it3->second.vpid_status))
|
||||
.arg(getSideString(it3->second.side))
|
||||
.arg(getLastContactString(it3->second.last_contact))
|
||||
.arg(getMasterKeyString(it3->second.encryption_master_key,32))
|
||||
),oy+=celly ;
|
||||
}
|
||||
else
|
||||
painter.drawText(ox+6*cellx,oy+celly,tr("Peer: %1: no information available")
|
||||
.arg(QString::fromStdString((*it2).toStdString()))
|
||||
),oy+=celly;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
oy += celly ;
|
||||
|
||||
pixmap = tmppixmap;
|
||||
maxHeight = std::max(oy,10*celly);
|
||||
}
|
||||
|
|
|
@ -37,29 +37,55 @@ class TurtleRouterDialog: public RsAutoUpdatePage, public Ui::TurtleRouterDialog
|
|||
|
||||
} ;
|
||||
|
||||
class GxsTunnelsDialog: public RsAutoUpdatePage
|
||||
class TunnelStatisticsDialog: public RsAutoUpdatePage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GxsTunnelsDialog(QWidget *parent = NULL) ;
|
||||
~GxsTunnelsDialog();
|
||||
TunnelStatisticsDialog(QWidget *parent = NULL) ;
|
||||
~TunnelStatisticsDialog();
|
||||
|
||||
// Cache for peer names.
|
||||
static QString getPeerName(const RsPeerId &peer_id) ;
|
||||
static QString getPeerName(const RsGxsId& gxs_id);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent *);
|
||||
virtual void resizeEvent(QResizeEvent *event);
|
||||
|
||||
int maxWidth ;
|
||||
int maxHeight ;
|
||||
|
||||
QPixmap pixmap;
|
||||
|
||||
private:
|
||||
void processSettings(bool bLoad);
|
||||
bool m_bProcessSettings;
|
||||
static QString speedString(float f);
|
||||
|
||||
virtual void updateDisplay() ;
|
||||
|
||||
int maxWidth ;
|
||||
int maxHeight ;
|
||||
|
||||
QPixmap pixmap;
|
||||
virtual void updateDisplay() =0;
|
||||
} ;
|
||||
|
||||
class GxsAuthenticatedTunnelsDialog: public TunnelStatisticsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GxsAuthenticatedTunnelsDialog(QWidget *parent = NULL) ;
|
||||
~GxsAuthenticatedTunnelsDialog() {}
|
||||
|
||||
private:
|
||||
virtual void updateDisplay() ;
|
||||
} ;
|
||||
|
||||
class GxsNetTunnelsDialog: public TunnelStatisticsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GxsNetTunnelsDialog(QWidget *parent = NULL) ;
|
||||
~GxsNetTunnelsDialog() {}
|
||||
|
||||
private:
|
||||
virtual void updateDisplay() ;
|
||||
} ;
|
||||
|
|
|
@ -195,11 +195,13 @@ TurtleRouterStatistics::TurtleRouterStatistics(QWidget *parent)
|
|||
_tunnel_statistics_F->setFrameStyle(QFrame::NoFrame);
|
||||
_tunnel_statistics_F->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
routertabWidget->addTab(new TurtleRouterDialog(),QString(tr("Anonymous tunnels")));
|
||||
routertabWidget->addTab(new GxsTunnelsDialog(),QString(tr("Authenticated tunnels")));
|
||||
routertabWidget->addTab(new TurtleRouterDialog(), QString(tr("File transfer tunnels")));
|
||||
routertabWidget->addTab(new GxsAuthenticatedTunnelsDialog(),QString(tr("Authenticated tunnels")));
|
||||
routertabWidget->addTab(new GxsNetTunnelsDialog(), QString(tr("GXS sync tunnels") ));
|
||||
|
||||
float fontHeight = QFontMetricsF(font()).height();
|
||||
float fact = fontHeight/14.0;
|
||||
|
||||
float fontHeight = QFontMetricsF(font()).height();
|
||||
float fact = fontHeight/14.0;
|
||||
frmGraph->setMinimumHeight(200*fact);
|
||||
|
||||
// load settings
|
||||
|
|
|
@ -26,12 +26,11 @@
|
|||
#include <QPixmap>
|
||||
|
||||
#include "retroshare/rsconfig.h"
|
||||
#include "retroshare/rsinit.h"
|
||||
#include "util/misc.h"
|
||||
|
||||
#ifdef RETROTOR
|
||||
#include "TorControl/TorManager.h"
|
||||
#include "TorControl/TorControl.h"
|
||||
#endif
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
|
@ -86,53 +85,56 @@ void TorStatus::getTorStatus()
|
|||
|
||||
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)
|
||||
if(RsAccounts::isTorAuto())
|
||||
{
|
||||
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 ;
|
||||
}
|
||||
// get Tor status
|
||||
int tor_control_status = Tor::TorManager::instance()->control()->status();
|
||||
int torstatus = Tor::TorManager::instance()->control()->torStatus();
|
||||
|
||||
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 ;
|
||||
}
|
||||
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)
|
||||
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
|
||||
{
|
||||
// RED - some issue.
|
||||
torstatusLabel->setPixmap(QPixmap(":/icons/tor-stopping.png").scaledToHeight(1.5*S,Qt::SmoothTransformation));
|
||||
torstatusLabel->setPixmap(QPixmap(":/icons/tor-stopping.png").scaledToHeight(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
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
static QMap<RsPlugin*, QTranslator*> translatorPlugins;
|
||||
|
||||
#define EXTERNAL_TRANSLATION_DIR QString::fromUtf8(RsAccounts::DataDirectory().c_str())
|
||||
#define EXTERNAL_TRANSLATION_DIR QString::fromUtf8(RsAccounts::systemDataDirectory().c_str())
|
||||
|
||||
/** Initializes the list of available languages. */
|
||||
QMap<QString, QString>
|
||||
|
|
|
@ -51,10 +51,8 @@
|
|||
# include "gui/settings/WebuiPage.h"
|
||||
#endif
|
||||
|
||||
#ifdef RETROTOR
|
||||
# include "TorControl/TorManager.h"
|
||||
# include "TorControl/TorControlWindow.h"
|
||||
#endif
|
||||
#include "TorControl/TorManager.h"
|
||||
#include "TorControl/TorControlWindow.h"
|
||||
|
||||
#include "retroshare/rsidentity.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
|
@ -349,51 +347,58 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
|||
|
||||
SoundManager::create();
|
||||
|
||||
#ifdef RETROTOR
|
||||
// Now that we know the Tor service running, and we know the SSL id, we can make sure it provides a viable hidden service
|
||||
bool is_hidden_node = false;
|
||||
bool is_auto_tor = false ;
|
||||
bool is_first_time = false ;
|
||||
|
||||
QString tor_hidden_service_dir = QString::fromStdString(RsAccounts::AccountDirectory()) + QString("/hidden_service/") ;
|
||||
RsAccounts::getCurrentAccountOptions(is_hidden_node,is_auto_tor,is_first_time);
|
||||
|
||||
Tor::TorManager *torManager = Tor::TorManager::instance();
|
||||
torManager->setDataDirectory(Rshare::dataDirectory() + QString("/tor/"));
|
||||
torManager->setHiddenServiceDirectory(tor_hidden_service_dir); // re-set it, because now it's changed to the specific location that is run
|
||||
|
||||
RsDirUtil::checkCreateDirectory(std::string(tor_hidden_service_dir.toUtf8())) ;
|
||||
|
||||
torManager->setupHiddenService();
|
||||
|
||||
if(! torManager->start() || torManager->hasError())
|
||||
if(is_auto_tor)
|
||||
{
|
||||
QMessageBox::critical(NULL,QObject::tr("Cannot start Tor Manager!"),QObject::tr("Tor cannot be started on your system: \n\n")+torManager->errorMessage()) ;
|
||||
return 1 ;
|
||||
}
|
||||
// Now that we know the Tor service running, and we know the SSL id, we can make sure it provides a viable hidden service
|
||||
|
||||
{
|
||||
TorControlDialog tcd(torManager) ;
|
||||
QString error_msg ;
|
||||
tcd.show();
|
||||
QString tor_hidden_service_dir = QString::fromStdString(RsAccounts::AccountDirectory()) + QString("/hidden_service/") ;
|
||||
|
||||
while(tcd.checkForTor(error_msg) != TorControlDialog::TOR_STATUS_OK || tcd.checkForHiddenService() != TorControlDialog::HIDDEN_SERVICE_STATUS_OK) // runs until some status is reached: either tor works, or it fails.
|
||||
Tor::TorManager *torManager = Tor::TorManager::instance();
|
||||
torManager->setTorDataDirectory(Rshare::dataDirectory() + QString("/tor/"));
|
||||
torManager->setHiddenServiceDirectory(tor_hidden_service_dir); // re-set it, because now it's changed to the specific location that is run
|
||||
|
||||
RsDirUtil::checkCreateDirectory(std::string(tor_hidden_service_dir.toUtf8())) ;
|
||||
|
||||
torManager->setupHiddenService();
|
||||
|
||||
if(! torManager->start() || torManager->hasError())
|
||||
{
|
||||
QCoreApplication::processEvents();
|
||||
rstime::rs_usleep(0.2*1000*1000) ;
|
||||
|
||||
if(!error_msg.isNull())
|
||||
{
|
||||
QMessageBox::critical(NULL,QObject::tr("Cannot start Tor"),QObject::tr("Sorry but Tor cannot be started on your system!\n\nThe error reported is:\"")+error_msg+"\"") ;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
tcd.hide();
|
||||
|
||||
if(tcd.checkForHiddenService() != TorControlDialog::HIDDEN_SERVICE_STATUS_OK)
|
||||
{
|
||||
QMessageBox::critical(NULL,QObject::tr("Cannot start a hidden tor service!"),QObject::tr("It was not possible to start a hidden service.")) ;
|
||||
QMessageBox::critical(NULL,QObject::tr("Cannot start Tor Manager!"),QObject::tr("Tor cannot be started on your system: \n\n")+torManager->errorMessage()) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
{
|
||||
TorControlDialog tcd(torManager) ;
|
||||
QString error_msg ;
|
||||
tcd.show();
|
||||
|
||||
while(tcd.checkForTor(error_msg) != TorControlDialog::TOR_STATUS_OK || tcd.checkForHiddenService() != TorControlDialog::HIDDEN_SERVICE_STATUS_OK) // runs until some status is reached: either tor works, or it fails.
|
||||
{
|
||||
QCoreApplication::processEvents();
|
||||
rstime::rs_usleep(0.2*1000*1000) ;
|
||||
|
||||
if(!error_msg.isNull())
|
||||
{
|
||||
QMessageBox::critical(NULL,QObject::tr("Cannot start Tor"),QObject::tr("Sorry but Tor cannot be started on your system!\n\nThe error reported is:\"")+error_msg+"\"") ;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
tcd.hide();
|
||||
|
||||
if(tcd.checkForHiddenService() != TorControlDialog::HIDDEN_SERVICE_STATUS_OK)
|
||||
{
|
||||
QMessageBox::critical(NULL,QObject::tr("Cannot start a hidden tor service!"),QObject::tr("It was not possible to start a hidden service.")) ;
|
||||
return 1 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
QSplashScreen splashScreen(QPixmap(":/images/logo/logo_splash.png")/* , Qt::WindowStaysOnTopHint*/);
|
||||
|
||||
|
@ -409,33 +414,35 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
|||
return 1;
|
||||
}
|
||||
|
||||
#ifdef RETROTOR
|
||||
// Tor works with viable hidden service. Let's use it!
|
||||
if(is_auto_tor)
|
||||
{
|
||||
// Tor works with viable hidden service. Let's use it!
|
||||
|
||||
QString service_id ;
|
||||
QString onion_address ;
|
||||
uint16_t service_port ;
|
||||
uint16_t service_target_port ;
|
||||
uint16_t proxy_server_port ;
|
||||
QHostAddress service_target_address ;
|
||||
QHostAddress proxy_server_address ;
|
||||
QString service_id ;
|
||||
QString onion_address ;
|
||||
uint16_t service_port ;
|
||||
uint16_t service_target_port ;
|
||||
uint16_t proxy_server_port ;
|
||||
QHostAddress service_target_address ;
|
||||
QHostAddress proxy_server_address ;
|
||||
|
||||
torManager->getHiddenServiceInfo(service_id,onion_address,service_port,service_target_address,service_target_port);
|
||||
torManager->getProxyServerInfo(proxy_server_address,proxy_server_port) ;
|
||||
Tor::TorManager *torManager = Tor::TorManager::instance();
|
||||
torManager->getHiddenServiceInfo(service_id,onion_address,service_port,service_target_address,service_target_port);
|
||||
torManager->getProxyServerInfo(proxy_server_address,proxy_server_port) ;
|
||||
|
||||
std::cerr << "Got hidden service info: " << std::endl;
|
||||
std::cerr << " onion address : " << onion_address.toStdString() << std::endl;
|
||||
std::cerr << " service_id : " << service_id.toStdString() << std::endl;
|
||||
std::cerr << " service port : " << service_port << std::endl;
|
||||
std::cerr << " target port : " << service_target_port << std::endl;
|
||||
std::cerr << " target address : " << service_target_address.toString().toStdString() << std::endl;
|
||||
std::cerr << "Got hidden service info: " << std::endl;
|
||||
std::cerr << " onion address : " << onion_address.toStdString() << std::endl;
|
||||
std::cerr << " service_id : " << service_id.toStdString() << std::endl;
|
||||
std::cerr << " service port : " << service_port << std::endl;
|
||||
std::cerr << " target port : " << service_target_port << std::endl;
|
||||
std::cerr << " target address : " << service_target_address.toString().toStdString() << std::endl;
|
||||
|
||||
std::cerr << "Setting proxy server to " << service_target_address.toString().toStdString() << ":" << service_target_port << std::endl;
|
||||
std::cerr << "Setting proxy server to " << service_target_address.toString().toStdString() << ":" << service_target_port << std::endl;
|
||||
|
||||
rsPeers->setLocalAddress(rsPeers->getOwnId(), service_target_address.toString().toStdString(), service_target_port);
|
||||
rsPeers->setHiddenNode(rsPeers->getOwnId(), onion_address.toStdString(), service_port);
|
||||
rsPeers->setProxyServer(RS_HIDDEN_TYPE_TOR, proxy_server_address.toString().toStdString(),proxy_server_port) ;
|
||||
#endif
|
||||
rsPeers->setLocalAddress(rsPeers->getOwnId(), service_target_address.toString().toStdString(), service_target_port);
|
||||
rsPeers->setHiddenNode(rsPeers->getOwnId(), onion_address.toStdString(), service_port);
|
||||
rsPeers->setProxyServer(RS_HIDDEN_TYPE_TOR, proxy_server_address.toString().toStdString(),proxy_server_port) ;
|
||||
}
|
||||
|
||||
Rshare::initPlugins();
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
TEMPLATE = app
|
||||
QT += network xml
|
||||
CONFIG += qt gui uic qrc resources idle
|
||||
CONFIG += qt gui uic qrc resources idle
|
||||
CONFIG += console
|
||||
TARGET = retroshare
|
||||
DEFINES += TARGET=\\\"$${TARGET}\\\"
|
||||
|
@ -19,11 +19,9 @@ libresapihttpserver {
|
|||
|
||||
!include("../../libretroshare/src/use_libretroshare.pri"):error("Including")
|
||||
|
||||
retrotor {
|
||||
FORMS += TorControl/TorControlWindow.ui
|
||||
SOURCES += TorControl/TorControlWindow.cpp
|
||||
HEADERS += TorControl/TorControlWindow.h
|
||||
}
|
||||
FORMS += TorControl/TorControlWindow.ui
|
||||
SOURCES += TorControl/TorControlWindow.cpp
|
||||
HEADERS += TorControl/TorControlWindow.h
|
||||
|
||||
#QMAKE_CFLAGS += -fmudflap
|
||||
#LIBS *= /usr/lib/gcc/x86_64-linux-gnu/4.4/libmudflap.a /usr/lib/gcc/x86_64-linux-gnu/4.4/libmudflapth.a
|
||||
|
@ -285,7 +283,8 @@ wikipoos {
|
|||
LIBS *= $$OUT_PWD/../../supportlibs/pegmarkdown/lib/libpegmarkdown.a
|
||||
}
|
||||
|
||||
retrotor {
|
||||
# Tor controller
|
||||
|
||||
HEADERS += TorControl/AddOnionCommand.h \
|
||||
TorControl/AuthenticateCommand.h \
|
||||
TorControl/GetConfCommand.h \
|
||||
|
@ -324,7 +323,6 @@ SOURCES += TorControl/AddOnionCommand.cpp \
|
|||
TorControl/SecureRNG.cpp \
|
||||
TorControl/Settings.cpp \
|
||||
TorControl/StrUtil.cpp
|
||||
}
|
||||
|
||||
# Input
|
||||
HEADERS += rshare.h \
|
||||
|
@ -367,6 +365,7 @@ HEADERS += rshare.h \
|
|||
gui/FileTransfer/DLListDelegate.h \
|
||||
gui/FileTransfer/ULListDelegate.h \
|
||||
gui/FileTransfer/TransfersDialog.h \
|
||||
gui/FileTransfer/BannedFilesDialog.h \
|
||||
gui/statistics/TurtleRouterDialog.h \
|
||||
gui/statistics/TurtleRouterStatistics.h \
|
||||
gui/statistics/dhtgraph.h \
|
||||
|
@ -478,7 +477,7 @@ HEADERS += rshare.h \
|
|||
gui/common/RsUrlHandler.h \
|
||||
gui/common/RsCollectionDialog.h \
|
||||
gui/common/rwindow.h \
|
||||
gui/common/html.h \
|
||||
gui/common/rshtml.h \
|
||||
gui/common/AvatarDefs.h \
|
||||
gui/common/GroupFlagsWidget.h \
|
||||
gui/common/GroupSelectionBox.h \
|
||||
|
@ -546,7 +545,7 @@ HEADERS += rshare.h \
|
|||
gui/elastic/graphwidget.h \
|
||||
gui/elastic/edge.h \
|
||||
gui/elastic/arrow.h \
|
||||
gui/elastic/node.h \
|
||||
gui/elastic/elnode.h \
|
||||
gui/NewsFeed.h \
|
||||
gui/feeds/FeedItem.h \
|
||||
gui/feeds/FeedHolder.h \
|
||||
|
@ -599,6 +598,7 @@ FORMS += gui/StartDialog.ui \
|
|||
gui/FileTransfer/DetailsDialog.ui \
|
||||
gui/FileTransfer/SearchDialog.ui \
|
||||
gui/FileTransfer/SharedFilesDialog.ui \
|
||||
gui/FileTransfer/BannedFilesDialog.ui \
|
||||
gui/MainWindow.ui \
|
||||
gui/NetworkView.ui \
|
||||
gui/MessengerWindow.ui \
|
||||
|
@ -745,6 +745,7 @@ SOURCES += main.cpp \
|
|||
gui/FileTransfer/xprogressbar.cpp \
|
||||
gui/FileTransfer/DetailsDialog.cpp \
|
||||
gui/FileTransfer/TransferUserNotify.cpp \
|
||||
gui/FileTransfer/BannedFilesDialog.cpp \
|
||||
gui/MainPage.cpp \
|
||||
gui/HelpDialog.cpp \
|
||||
gui/LogoBar.cpp \
|
||||
|
@ -796,7 +797,7 @@ SOURCES += main.cpp \
|
|||
gui/common/RsCollectionDialog.cpp \
|
||||
gui/common/RsUrlHandler.cpp \
|
||||
gui/common/rwindow.cpp \
|
||||
gui/common/html.cpp \
|
||||
gui/common/rshtml.cpp \
|
||||
gui/common/AvatarDefs.cpp \
|
||||
gui/common/AvatarDialog.cpp \
|
||||
gui/common/GroupFlagsWidget.cpp \
|
||||
|
@ -897,7 +898,7 @@ SOURCES += main.cpp \
|
|||
gui/elastic/graphwidget.cpp \
|
||||
gui/elastic/edge.cpp \
|
||||
gui/elastic/arrow.cpp \
|
||||
gui/elastic/node.cpp \
|
||||
gui/elastic/elnode.cpp \
|
||||
gui/NewsFeed.cpp \
|
||||
gui/feeds/FeedItem.cpp \
|
||||
gui/feeds/FeedHolder.cpp \
|
||||
|
@ -1369,3 +1370,44 @@ gxsgui {
|
|||
|
||||
|
||||
}
|
||||
|
||||
cmark {
|
||||
DEFINES *= USE_CMARK
|
||||
|
||||
HEADERS += \
|
||||
../../supportlibs/cmark/src/buffer.h \
|
||||
../../supportlibs/cmark/src/chunk.h \
|
||||
../../supportlibs/cmark/src/cmark.h \
|
||||
../../supportlibs/cmark/src/cmark_ctype.h \
|
||||
../../supportlibs/cmark/src/houdini.h \
|
||||
../../supportlibs/cmark/src/inlines.h \
|
||||
../../supportlibs/cmark/src/iterator.h \
|
||||
../../supportlibs/cmark/src/node.h \
|
||||
../../supportlibs/cmark/src/parser.h \
|
||||
../../supportlibs/cmark/src/references.h \
|
||||
../../supportlibs/cmark/src/render.h \
|
||||
../../supportlibs/cmark/src/scanners.h \
|
||||
../../supportlibs/cmark/src/utf8.h \
|
||||
|
||||
SOURCES += \
|
||||
../../supportlibs/cmark/src/blocks.c \
|
||||
../../supportlibs/cmark/src/buffer.c \
|
||||
../../supportlibs/cmark/src/cmark.c \
|
||||
../../supportlibs/cmark/src/cmark_ctype.c \
|
||||
../../supportlibs/cmark/src/commonmark.c \
|
||||
../../supportlibs/cmark/src/houdini_href_e.c \
|
||||
../../supportlibs/cmark/src/houdini_html_e.c \
|
||||
../../supportlibs/cmark/src/houdini_html_u.c \
|
||||
../../supportlibs/cmark/src/html.c \
|
||||
../../supportlibs/cmark/src/inlines.c \
|
||||
../../supportlibs/cmark/src/iterator.c \
|
||||
../../supportlibs/cmark/src/latex.c \
|
||||
../../supportlibs/cmark/src/man.c \
|
||||
../../supportlibs/cmark/src/node.c \
|
||||
../../supportlibs/cmark/src/references.c \
|
||||
../../supportlibs/cmark/src/render.c \
|
||||
../../supportlibs/cmark/src/scanners.c \
|
||||
../../supportlibs/cmark/src/utf8.c \
|
||||
../../supportlibs/cmark/src/xml.c \
|
||||
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include <iostream>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <gui/common/html.h>
|
||||
#include <gui/common/rshtml.h>
|
||||
#include <gui/common/vmessagebox.h>
|
||||
#include <gui/gxs/GxsIdDetails.h>
|
||||
#include <gui/settings/rsharesettings.h>
|
||||
|
@ -360,7 +360,7 @@ QString Rshare::retroshareVersion(bool withRevision)
|
|||
{
|
||||
QString version = QString("%1.%2.%3%4").arg(RS_MAJOR_VERSION).arg(RS_MINOR_VERSION).arg(RS_BUILD_NUMBER).arg(RS_BUILD_NUMBER_ADD);
|
||||
if (withRevision) {
|
||||
version += QString(" %1 %2").arg(tr("Revision")).arg(QString::number(RS_REVISION_NUMBER,16));
|
||||
version += QString(" %1 %2").arg(tr("Revision")).arg(RS_REVISION_NUMBER,8,16,QChar('0'));
|
||||
}
|
||||
|
||||
return version;
|
||||
|
@ -748,7 +748,7 @@ void Rshare::loadStyleSheet(const QString &sheetName)
|
|||
/* external stylesheet */
|
||||
file.setFileName(QString("%1/qss/%2%3.qss").arg(QString::fromUtf8(RsAccounts::ConfigDirectory().c_str()), name, sheetName));
|
||||
if (!file.exists()) {
|
||||
file.setFileName(QString("%1/qss/%2%3.qss").arg(QString::fromUtf8(RsAccounts::DataDirectory().c_str()), name, sheetName));
|
||||
file.setFileName(QString("%1/qss/%2%3.qss").arg(QString::fromUtf8(RsAccounts::systemDataDirectory().c_str()), name, sheetName));
|
||||
}
|
||||
}
|
||||
if (file.open(QFile::ReadOnly)) {
|
||||
|
@ -787,7 +787,7 @@ void Rshare::getAvailableStyleSheets(QMap<QString, QString> &styleSheets)
|
|||
styleSheets.insert(name, name);
|
||||
}
|
||||
}
|
||||
fileInfoList = QDir(QString::fromUtf8(RsAccounts::DataDirectory().c_str()) + "/qss/").entryInfoList(QStringList("*.qss"));
|
||||
fileInfoList = QDir(QString::fromUtf8(RsAccounts::systemDataDirectory().c_str()) + "/qss/").entryInfoList(QStringList("*.qss"));
|
||||
foreach (fileInfo, fileInfoList) {
|
||||
if (fileInfo.isFile()) {
|
||||
QString name = fileInfo.baseName();
|
||||
|
|
|
@ -38,6 +38,13 @@
|
|||
#include "util/imageutil.h"
|
||||
#include "util/rstime.h"
|
||||
|
||||
#ifdef USE_CMARK
|
||||
//Include for CMark
|
||||
// This needs to be fixed: use system library if available, etc.
|
||||
#include <gui/../../../supportlibs/cmark/src/cmark.h>
|
||||
#include <gui/../../../supportlibs/cmark/src/node.h>
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
|
||||
/**
|
||||
|
@ -582,6 +589,31 @@ QString RsHtml::formatText(QTextDocument *textDocument, const QString &text, ulo
|
|||
// Save Space and Tab because doc loose it.
|
||||
formattedText=saveSpace(formattedText);
|
||||
|
||||
#ifdef USE_CMARK
|
||||
if (flag & RSHTML_FORMATTEXT_USE_CMARK) {
|
||||
// Transform html to plain text
|
||||
QTextBrowser textBrowser;
|
||||
textBrowser.setHtml(text);
|
||||
formattedText = textBrowser.toPlainText();
|
||||
// Parse CommonMark
|
||||
int options = CMARK_OPT_DEFAULT;
|
||||
cmark_parser *parser = cmark_parser_new(options);
|
||||
cmark_parser_feed(parser, formattedText.toStdString().c_str(),formattedText.length());
|
||||
cmark_node *document = cmark_parser_finish(parser);
|
||||
cmark_parser_free(parser);
|
||||
char *result;
|
||||
result = cmark_render_html(document, options);
|
||||
// Get result as html
|
||||
formattedText = QString::fromUtf8(result);
|
||||
//Clean
|
||||
cmark_node_mem(document)->free(result);
|
||||
cmark_node_free(document);
|
||||
//Get document formed HTML
|
||||
textBrowser.setHtml(formattedText);
|
||||
formattedText=textBrowser.toHtml();
|
||||
}
|
||||
#endif
|
||||
|
||||
QString errorMsg; int errorLine; int errorColumn;
|
||||
|
||||
QDomDocument doc;
|
||||
|
@ -981,6 +1013,12 @@ static void styleCreate(QDomDocument& doc
|
|||
noEmbedAttr.setValue("true");
|
||||
styleElem.attributes().setNamedItem(noEmbedAttr);
|
||||
}
|
||||
if (flag & RSHTML_FORMATTEXT_USE_CMARK) {
|
||||
QDomAttr cMarkAttr;
|
||||
cMarkAttr = doc.createAttribute("CMark");
|
||||
cMarkAttr.setValue("true");
|
||||
styleElem.attributes().setNamedItem(cMarkAttr);
|
||||
}
|
||||
}
|
||||
|
||||
while(styleElem.childNodes().count()>0) {
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#define RSHTML_FORMATTEXT_REMOVE_FONT (RSHTML_FORMATTEXT_REMOVE_FONT_WEIGHT | RSHTML_FORMATTEXT_REMOVE_FONT_STYLE | RSHTML_FORMATTEXT_REMOVE_FONT_FAMILY | RSHTML_FORMATTEXT_REMOVE_FONT_SIZE)
|
||||
#define RSHTML_FORMATTEXT_CLEANSTYLE (RSHTML_FORMATTEXT_REMOVE_FONT | RSHTML_FORMATTEXT_REMOVE_COLOR)
|
||||
#define RSHTML_FORMATTEXT_NO_EMBED 0x0400//1024
|
||||
#define RSHTML_FORMATTEXT_USE_CMARK 0x0800//2048
|
||||
/* Flags for RsHtml::optimizeHtml */
|
||||
#define RSHTML_OPTIMIZEHTML_MASK (RSHTML_FORMATTEXT_CLEANSTYLE | RSHTML_FORMATTEXT_FIX_COLORS | RSHTML_FORMATTEXT_OPTIMIZE)
|
||||
|
||||
|
|
|
@ -79,5 +79,8 @@ void RsGxsUpdateBroadcast::onChangesReceived(const RsGxsChanges& changes)
|
|||
emit grpsChanged(changes.mGrps, changes.mGrpsMeta);
|
||||
}
|
||||
|
||||
if(!changes.mDistantSearchReqs.empty())
|
||||
emit distantSearchResultsChanged(changes.mDistantSearchReqs) ;
|
||||
|
||||
emit changed();
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
class RsGxsIfaceHelper;
|
||||
class RsGxsChanges;
|
||||
|
||||
typedef uint32_t TurtleRequestId ;
|
||||
|
||||
class RsGxsUpdateBroadcast : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -21,6 +23,7 @@ signals:
|
|||
void changed();
|
||||
void msgsChanged(const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIds, const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIdsMeta);
|
||||
void grpsChanged(const std::list<RsGxsGroupId>& grpIds, const std::list<RsGxsGroupId>& grpIdsMeta);
|
||||
void distantSearchResultsChanged(const std::list<TurtleRequestId>& reqs);
|
||||
|
||||
private slots:
|
||||
void onChangesReceived(const RsGxsChanges& changes);
|
||||
|
|
|
@ -164,8 +164,8 @@ bool TokenQueue::checkForRequest(uint32_t token)
|
|||
{
|
||||
/* check token */
|
||||
uint32_t status = mService->requestStatus(token);
|
||||
return ( (RsTokenService::GXS_REQUEST_V2_STATUS_FAILED == status) ||
|
||||
(RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE == status) );
|
||||
return ( (RsTokenService::FAILED == status) ||
|
||||
(RsTokenService::COMPLETE == status) );
|
||||
}
|
||||
|
||||
bool TokenQueue::activeRequestExist(const uint32_t& userType) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue