Merge pull request #1829 from G10h4ck/rsfiles_links

RsFiles links support in libretroshare + a bunch of fixes
This commit is contained in:
G10h4ck 2020-04-20 17:12:04 +02:00 committed by GitHub
commit 2b44492cb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
77 changed files with 2949 additions and 1667 deletions

View file

@ -623,10 +623,7 @@ void SharedFilesDialog::copyLinks(const QModelIndexList& lst, bool remote,QList<
if (details.type == DIR_TYPE_DIR)
{
FileTree *ft = FileTree::create(details,remote) ;
std::cerr << "Created collection file tree:" << std::endl;
ft->print();
auto ft = RsFileTree::fromDirDetails(details,remote);
QString dir_name = QDir(QString::fromUtf8(details.name.c_str())).dirName();
@ -634,8 +631,6 @@ void SharedFilesDialog::copyLinks(const QModelIndexList& lst, bool remote,QList<
if(link.valid())
urls.push_back(link) ;
delete ft ;
}
else
{

View file

@ -1076,30 +1076,36 @@ TransfersDialog::TransfersDialog(QWidget *parent)
// load settings
processSettings(true);
int S = QFontMetricsF(font()).height();
QString help_str = tr(
" <h1><img width=\"%1\" src=\":/icons/help_64.png\">&nbsp;&nbsp;File Transfer</h1> \
<p>Retroshare brings two ways of transferring files: direct transfers from your friends, and \
distant anonymous tunnelled transfers. In addition, file transfer is multi-source and allows swarming \
(you can be a source while downloading)</p> \
<p>You can share files using the <img src=\":/images/directoryadd_24x24_shadow.png\" width=%2 /> icon from the left side bar. \
These files will be listed in the My Files tab. You can decide for each friend group whether they can or not see these files \
in their Friends Files tab</p>\
<p>The search tab reports files from your friends' file lists, and distant files that can be reached \
anonymously using the multi-hop tunnelling system.</p> \
").arg(QString::number(2*S)).arg(QString::number(S)) ;
int S = static_cast<int>(QFontMetricsF(font()).height());
QString help_str = tr(
"<h1><img width=\"%1\" src=\":/icons/help_64.png\">&nbsp;&nbsp;"
"File Transfer</h1>"
"<p>Retroshare brings two ways of transferring files: direct "
"transfers from your friends, and distant anonymous tunnelled "
"transfers. In addition, file transfer is multi-source and "
"allows swarming (you can be a source while downloading)</p>"
"<p>You can share files using the "
"<img src=\":/images/directoryadd_24x24_shadow.png\" width=%2 />"
" icon from the left side bar. These files will be listed in "
"the My Files tab. You can decide for each friend group whether"
" they can or not see these files in their Friends Files tab</p>"
"<p>The search tab reports files from your friends' file lists,"
" and distant files that can be reached anonymously using the "
"multi-hop tunnelling system.</p>")
.arg(QString::number(2*S)).arg(QString::number(S)) ;
registerHelpButton(ui.helpButton,help_str,"TransfersDialog") ;
registerHelpButton(ui.helpButton,help_str,"TransfersDialog") ;
mEventHandlerId=0;
rsEvents->registerEventsHandler(RsEventType::FILE_TRANSFER, [this](std::shared_ptr<const RsEvent> event) { handleEvent(event); }, mEventHandlerId );
mEventHandlerId=0;
rsEvents->registerEventsHandler(
[this](std::shared_ptr<const RsEvent> event) { handleEvent(event); },
mEventHandlerId, RsEventType::FILE_TRANSFER );
}
void TransfersDialog::handleEvent(std::shared_ptr<const RsEvent> event)
{
if(event->mType != RsEventType::FILE_TRANSFER)
return;
if(event->mType != RsEventType::FILE_TRANSFER) return;
const RsFileTransferEvent *fe = dynamic_cast<const RsFileTransferEvent*>(event.get());
if(!fe)
@ -2225,9 +2231,8 @@ void TransfersDialog::pasteLink()
for(QList<RetroShareLink>::const_iterator it(links.begin());it!=links.end();++it)
{
FileTree *ft = FileTree::create((*it).radix().toStdString()) ;
col.merge_in(*ft) ;
auto ft = RsFileTree::fromRadix64((*it).radix().toStdString());
col.merge_in(*ft);
}
links.clear();
RSLinkClipboard::pasteLinks(links,RetroShareLink::TYPE_FILE);