mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-15 16:49:20 -05:00
added an optional cache for hashes, so that hashed files are remembered for some days.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3729 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
5cc222d251
commit
630156a5e8
11 changed files with 493 additions and 45 deletions
|
|
@ -115,7 +115,6 @@ private:
|
|||
QAction* sendchatlinkAct;
|
||||
QAction* copylinklocalhtmlAct;
|
||||
|
||||
QTreeView *shareddirtreeview;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::SharedFilesDialog ui;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "DirectoriesPage.h"
|
||||
#include "gui/ShareManager.h"
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "rshare.h"
|
||||
#include <retroshare/rsfiles.h>
|
||||
|
|
@ -52,10 +53,19 @@ DirectoriesPage::DirectoriesPage(QWidget * parent, Qt::WFlags flags)
|
|||
ui.checkBox->setChecked(false); /* signal not emitted */
|
||||
}
|
||||
|
||||
uint32_t t = rsFiles->rememberHashFilesDuration() ;
|
||||
bool b = rsFiles->rememberHashFiles() ;
|
||||
|
||||
ui.rememberHashesSB->setValue(t) ;
|
||||
ui.rememberHashesCB->setChecked(b) ;
|
||||
|
||||
connect(ui.incomingButton, SIGNAL(clicked( bool ) ), this , SLOT( setIncomingDirectory() ) );
|
||||
connect(ui.partialButton, SIGNAL(clicked( bool ) ), this , SLOT( setPartialsDirectory() ) );
|
||||
connect(ui.checkBox, SIGNAL(stateChanged(int)), this, SLOT(shareDownloadDirectory(int)));
|
||||
connect(ui.editButton, SIGNAL(clicked()), this, SLOT(editDirectories()));
|
||||
connect(ui.cleanHashCachePB, SIGNAL(clicked()), this, SLOT(clearHashCache()));
|
||||
connect(ui.rememberHashesCB, SIGNAL(toggled(bool)), this, SLOT(toggleRememberHashes(bool)));
|
||||
connect(ui.rememberHashesSB, SIGNAL(valueChanged(int)), this, SLOT(setRememberHashesDuration(int)));
|
||||
|
||||
/* Hide platform specific features */
|
||||
#ifdef Q_WS_WIN
|
||||
|
|
@ -63,6 +73,40 @@ DirectoriesPage::DirectoriesPage(QWidget * parent, Qt::WFlags flags)
|
|||
#endif
|
||||
}
|
||||
|
||||
void DirectoriesPage::setRememberHashesDuration(int d)
|
||||
{
|
||||
rsFiles->setRememberHashFilesDuration(d) ;
|
||||
}
|
||||
|
||||
void DirectoriesPage::toggleRememberHashes(bool b)
|
||||
{
|
||||
if(!b)
|
||||
{
|
||||
if(QMessageBox::question(NULL,"Cache cleaning confirmation","The will forget any former hash of non shared files. Do you confirm ?") == QMessageBox::Ok)
|
||||
{
|
||||
rsFiles->clearHashCache() ;
|
||||
rsFiles->setRememberHashFiles(b) ;
|
||||
ui.rememberHashesSB->setEnabled(false) ;
|
||||
ui.cleanHashCachePB->setEnabled(false) ;
|
||||
}
|
||||
else
|
||||
ui.rememberHashesCB->setChecked(true) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
rsFiles->setRememberHashFiles(true) ;
|
||||
ui.rememberHashesSB->setEnabled(true) ;
|
||||
ui.cleanHashCachePB->setEnabled(true) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DirectoriesPage::clearHashCache()
|
||||
{
|
||||
if(QMessageBox::question(NULL,"Cache cleaning confirmation","The will forget any former hash of non shared files. Do you confirm ?", QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok)
|
||||
rsFiles->clearHashCache() ;
|
||||
}
|
||||
|
||||
void
|
||||
DirectoriesPage::closeEvent (QCloseEvent * event)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -42,15 +42,13 @@ class DirectoriesPage: public ConfigPage
|
|||
|
||||
private slots:
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
void addShareDirectory();
|
||||
void removeShareDirectory();
|
||||
#endif
|
||||
|
||||
void editDirectories() ;
|
||||
void setIncomingDirectory();
|
||||
void setPartialsDirectory();
|
||||
void shareDownloadDirectory(int state);
|
||||
void clearHashCache() ;
|
||||
void setRememberHashesDuration(int) ;
|
||||
void toggleRememberHashes(bool) ;
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>477</width>
|
||||
<width>483</width>
|
||||
<height>439</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
@ -604,29 +604,96 @@
|
|||
<property name="title">
|
||||
<string>Shared Directories</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QListWidget" name="dirList"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Automatically share incoming directory (Recommended)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Automatically share incoming directory (Recommended)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="editButton">
|
||||
<property name="text">
|
||||
<string>Edit Share</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="editButton">
|
||||
<property name="text">
|
||||
<string>Edit Share</string>
|
||||
</property>
|
||||
</widget>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="rememberHashesCB">
|
||||
<property name="toolTip">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;">
|
||||
<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Remember file hashes even if not shared. </p>
|
||||
<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This might be useful if you're sharing an </p>
|
||||
<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">external HD, to avoid re-hashing files when </p>
|
||||
<p align="justify" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">you plug it in.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remember hashed files for </string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="rememberHashesSB">
|
||||
<property name="suffix">
|
||||
<string> days</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>365</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cleanHashCachePB">
|
||||
<property name="toolTip">
|
||||
<string>Forget any hashed file that is not anymore shared.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clean Hash Cache</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue