Merge pull request #1026 from csoler/v0.6-FT

V0.6 ft
This commit is contained in:
csoler 2017-09-11 19:05:19 +02:00 committed by GitHub
commit c5f91e3b6b
15 changed files with 333 additions and 27 deletions

View file

@ -54,6 +54,30 @@ TransferPage::TransferPage(QWidget * parent, Qt::WindowFlags flags)
QObject::connect(ui.autoCheckDirectoriesDelay_SB,SIGNAL(valueChanged(int)),this,SLOT(updateAutoScanDirectoriesPeriod())) ;
QObject::connect(ui.shareDownloadDirectoryCB, SIGNAL(toggled(bool)), this,SLOT(updateShareDownloadDirectory())) ;
QObject::connect(ui.followSymLinks_CB, SIGNAL(toggled(bool)), this,SLOT(updateFollowSymLinks())) ;
QObject::connect(ui.prefixesIgnoreList_LE, SIGNAL(editingFinished()), this,SLOT(updateIgnoreLists())) ;
QObject::connect(ui.prefixesIgnoreList_CB, SIGNAL(toggled(bool)), this,SLOT(updateIgnoreLists())) ;
QObject::connect(ui.suffixesIgnoreList_LE, SIGNAL(editingFinished()), this,SLOT(updateIgnoreLists())) ;
QObject::connect(ui.suffixesIgnoreList_CB, SIGNAL(toggled(bool)), this,SLOT(updateIgnoreLists())) ;
}
void TransferPage::updateIgnoreLists()
{
uint32_t flags = 0 ;
if(ui.prefixesIgnoreList_CB->isChecked()) flags |= RS_FILE_SHARE_FLAGS_IGNORE_PREFIXES ;
if(ui.suffixesIgnoreList_CB->isChecked()) flags |= RS_FILE_SHARE_FLAGS_IGNORE_SUFFIXES ;
std::list<std::string> lp,ls ;
{ QStringList L = ui.prefixesIgnoreList_LE->text().split(';') ; for(QStringList::const_iterator it(L.begin());it!=L.end();++it) lp.push_back((*it).toStdString()) ; }
{ QStringList L = ui.suffixesIgnoreList_LE->text().split(';') ; for(QStringList::const_iterator it(L.begin());it!=L.end();++it) ls.push_back((*it).toStdString()) ; }
rsFiles->setIgnoreLists(lp,ls,flags) ;
std::cerr << "Setting ignore lists: " << std::endl;
std::cerr << " flags: " << flags << std::endl;
std::cerr << " prefixes: " ; for(auto it(lp.begin());it!=lp.end();++it) std::cerr << "\"" << *it << "\" " ; std::cerr << std::endl;
std::cerr << " suffixes: " ; for(auto it(ls.begin());it!=ls.end();++it) std::cerr << "\"" << *it << "\" " ; std::cerr << std::endl;
}
void TransferPage::updateMaxTRUpRate(int b)
@ -125,6 +149,32 @@ void TransferPage::load()
case RS_FILE_PERM_DIRECT_DL_NO: whileBlocking(ui._filePermDirectDL_CB)->setCurrentIndex(1) ; break ;
default: whileBlocking(ui._filePermDirectDL_CB)->setCurrentIndex(2) ; break ;
}
std::list<std::string> suffixes, prefixes;
uint32_t ignore_flags ;
rsFiles->getIgnoreLists(prefixes,suffixes,ignore_flags) ;
QString ignore_prefixes_string,ignore_suffixes_string ;
for(auto it(prefixes.begin());it!=prefixes.end();)
{
ignore_prefixes_string += QString::fromStdString(*it) ;
if(++it != prefixes.end())
ignore_prefixes_string += ";" ;
}
for(auto it(suffixes.begin());it!=suffixes.end();)
{
ignore_suffixes_string += QString::fromStdString(*it) ;
if(++it != suffixes.end())
ignore_suffixes_string += ";" ;
}
whileBlocking(ui.prefixesIgnoreList_CB)->setChecked( ignore_flags & RS_FILE_SHARE_FLAGS_IGNORE_PREFIXES ) ;
whileBlocking(ui.suffixesIgnoreList_CB)->setChecked( ignore_flags & RS_FILE_SHARE_FLAGS_IGNORE_SUFFIXES ) ;
whileBlocking(ui.prefixesIgnoreList_LE)->setText( ignore_prefixes_string );
whileBlocking(ui.suffixesIgnoreList_LE)->setText( ignore_suffixes_string );
}
void TransferPage::updateDefaultStrategy(int i)

View file

@ -50,6 +50,7 @@ class TransferPage: public ConfigPage
void updateEncryptionPolicy(int);
void updateMaxUploadSlots(int);
void updateFilePermDirectDL(int);
void updateIgnoreLists();
void editDirectories() ;
void setIncomingDirectory();

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1126</width>
<height>1099</height>
<height>1103</height>
</rect>
</property>
<layout class="QVBoxLayout" name="TransferPageVLayout">
@ -16,7 +16,7 @@
<property name="title">
<string>Shared Directories</string>
</property>
<layout class="QVBoxLayout" name="sharedGBoxVLayout">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="shareDownloadHLayout">
<item>
@ -88,6 +88,34 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QCheckBox" name="suffixesIgnoreList_CB">
<property name="text">
<string>ignore files with these suffixes:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="suffixesIgnoreList_LE"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="prefixesIgnoreList_CB">
<property name="text">
<string>ignore files with these prefixes:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="prefixesIgnoreList_LE"/>
</item>
</layout>
</item>
</layout>
</widget>
</item>

View file

@ -22,7 +22,9 @@
#include <QLayout>
#include <QLabel>
#include <QMovie>
#include <QToolButton>
#include "retroshare/rsfiles.h"
#include "hashingstatus.h"
#include "gui/common/ElidedLabel.h"
#include "gui/notifyqt.h"
@ -61,13 +63,14 @@ HashingStatus::~HashingStatus()
void HashingStatus::updateHashingInfo(const QString& s)
{
if (s.isEmpty()) {
if (s.isEmpty())
{
statusHashing->hide() ;
hashloader->hide() ;
movie->stop() ;
} else {
hashloader->setToolTip(s) ;
setToolTip(s + "\n"+QObject::tr("Click to pause the hashing process"));
if (_compactMode) {
statusHashing->hide() ;
@ -80,3 +83,24 @@ void HashingStatus::updateHashingInfo(const QString& s)
movie->start() ;
}
}
void HashingStatus::mousePressEvent(QMouseEvent *)
{
rsFiles->togglePauseHashingProcess() ;
if(rsFiles->hashingProcessPaused())
{
movie->stop() ;
hashloader->setPixmap(QPixmap(":/images/resume.png")) ;
mLastText = statusHashing->text();
statusHashing->setText(QObject::tr("[Hashing is paused]"));
setToolTip(QObject::tr("Click to resume the hashing process"));
}
else
{
hashloader->setMovie(movie) ;
statusHashing->setText(mLastText);
movie->start() ;
}
}

View file

@ -35,6 +35,7 @@ public:
~HashingStatus();
void setCompactMode(bool compact) {_compactMode = compact; }
void mousePressEvent(QMouseEvent *);
public slots:
void updateHashingInfo(const QString&) ;
@ -42,6 +43,7 @@ public slots:
private:
ElidedLabel *statusHashing;
QLabel *hashloader;
QString mLastText ;
QMovie *movie;
bool _compactMode;
};