mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-26 07:16:11 -05:00
Removed member ftController::mShareDownloadDir and calculate the value from the shared directories.
Combined the two methods for share and unshare of the download dir. Added share incoming directory to the QuickStartWizard. Recompile of the GUI needed. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4089 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
4779d83ab7
commit
af4dd635e3
@ -100,7 +100,6 @@ ftController::ftController(CacheStrapper *cs, ftDataMultiplex *dm, std::string c
|
||||
mDataplex(dm),
|
||||
mTurtle(NULL),
|
||||
mFtActive(false),
|
||||
mShareDownloadDir(true),
|
||||
mDefaultChunkStrategy(FileChunksInfo::CHUNK_STRATEGY_RANDOM)
|
||||
{
|
||||
_max_active_downloads = 5 ; // default queue size
|
||||
@ -1845,7 +1844,6 @@ bool ftController::CancelCacheFile(RsPeerId id, std::string path, std::string ha
|
||||
const std::string active_downloads_size_ss("MAX_ACTIVE_DOWNLOADS");
|
||||
const std::string download_dir_ss("DOWN_DIR");
|
||||
const std::string partial_dir_ss("PART_DIR");
|
||||
const std::string share_dwl_dir("SHARE_DWL_DIR");
|
||||
const std::string default_chunk_strategy_ss("DEFAULT_CHUNK_STRATEGY");
|
||||
const std::string free_space_limit_ss("FREE_SPACE_LIMIT");
|
||||
|
||||
@ -1880,7 +1878,6 @@ bool ftController::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
||||
configMap[active_downloads_size_ss] = strm.str() ;
|
||||
configMap[download_dir_ss] = getDownloadDirectory();
|
||||
configMap[partial_dir_ss] = getPartialsDirectory();
|
||||
configMap[share_dwl_dir] = mShareDownloadDir ? "YES" : "NO";
|
||||
configMap[default_chunk_strategy_ss] = (mDefaultChunkStrategy==FileChunksInfo::CHUNK_STRATEGY_STREAMING) ? "STREAMING" : "RANDOM";
|
||||
|
||||
std::ostringstream s ;
|
||||
@ -2074,18 +2071,6 @@ bool ftController::loadConfigMap(std::map<std::string, std::string> &configMap)
|
||||
setPartialsDirectory(mit->second);
|
||||
}
|
||||
|
||||
if (configMap.end() != (mit = configMap.find(share_dwl_dir)))
|
||||
{
|
||||
if (mit->second == "YES")
|
||||
{
|
||||
setShareDownloadDirectory(true);
|
||||
}
|
||||
else if (mit->second == "NO")
|
||||
{
|
||||
setShareDownloadDirectory(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (configMap.end() != (mit = configMap.find(default_chunk_strategy_ss)))
|
||||
{
|
||||
if(mit->second == "STREAMING")
|
||||
@ -2143,17 +2128,3 @@ void ftController::setDefaultChunkStrategy(FileChunksInfo::ChunkStrategy S)
|
||||
mDefaultChunkStrategy = S ;
|
||||
IndicateConfigChanged() ;
|
||||
}
|
||||
|
||||
void ftController::setShareDownloadDirectory(bool value)
|
||||
{
|
||||
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
|
||||
mShareDownloadDir = value;
|
||||
IndicateConfigChanged() ;
|
||||
}
|
||||
|
||||
bool ftController::getShareDownloadDirectory()
|
||||
{
|
||||
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
|
||||
return mShareDownloadDir;
|
||||
}
|
||||
|
||||
|
@ -126,9 +126,6 @@ class ftController: public CacheTransfer, public RsThread, public pqiMonitor, pu
|
||||
bool activate();
|
||||
bool isActiveAndNoPending();
|
||||
|
||||
void setShareDownloadDirectory(bool value);
|
||||
bool getShareDownloadDirectory();
|
||||
|
||||
virtual void run();
|
||||
|
||||
/***************************************************************/
|
||||
@ -259,8 +256,6 @@ class ftController: public CacheTransfer, public RsThread, public pqiMonitor, pu
|
||||
std::list<ftPendingRequest> mPendingRequests;
|
||||
std::map<std::string,RsFileTransfer*> mPendingChunkMaps ;
|
||||
|
||||
/* share incoming directory */
|
||||
bool mShareDownloadDir;
|
||||
FileChunksInfo::ChunkStrategy mDefaultChunkStrategy ;
|
||||
|
||||
uint32_t _max_active_downloads ; // maximum number of simultaneous downloads
|
||||
|
@ -665,27 +665,33 @@ void ftServer::clearHashCache()
|
||||
mFiMon->clearHashCache() ;
|
||||
}
|
||||
|
||||
void ftServer::setShareDownloadDirectory(bool value)
|
||||
{
|
||||
mFtController->setShareDownloadDirectory(value);
|
||||
}
|
||||
|
||||
bool ftServer::getShareDownloadDirectory()
|
||||
{
|
||||
return mFtController->getShareDownloadDirectory();
|
||||
std::list<SharedDirInfo> dirList;
|
||||
mFiMon->getSharedDirectories(dirList);
|
||||
|
||||
std::string dir = mFtController->getDownloadDirectory();
|
||||
|
||||
// check if the download directory is in the list.
|
||||
for (std::list<SharedDirInfo>::const_iterator it(dirList.begin()); it != dirList.end(); ++it)
|
||||
if ((*it).filename == dir)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ftServer::shareDownloadDirectory()
|
||||
bool ftServer::shareDownloadDirectory(bool share)
|
||||
{
|
||||
SharedDirInfo inf ;
|
||||
inf.filename = mFtController->getDownloadDirectory();
|
||||
inf.shareflags = RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_BROWSABLE ;
|
||||
if (share) {
|
||||
/* Share */
|
||||
SharedDirInfo inf ;
|
||||
inf.filename = mFtController->getDownloadDirectory();
|
||||
inf.shareflags = RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_BROWSABLE ;
|
||||
|
||||
return addSharedDirectory(inf);
|
||||
}
|
||||
return addSharedDirectory(inf);
|
||||
}
|
||||
|
||||
bool ftServer::unshareDownloadDirectory()
|
||||
{
|
||||
/* Unshare */
|
||||
std::string dir = mFtController->getDownloadDirectory();
|
||||
return removeSharedDirectory(dir);
|
||||
}
|
||||
|
@ -197,10 +197,8 @@ virtual bool addSharedDirectory(const SharedDirInfo& dir);
|
||||
virtual bool updateShareFlags(const SharedDirInfo& dir); // updates the flags. The directory should already exist !
|
||||
virtual bool removeSharedDirectory(std::string dir);
|
||||
|
||||
virtual void setShareDownloadDirectory(bool value);
|
||||
virtual bool getShareDownloadDirectory();
|
||||
virtual bool shareDownloadDirectory();
|
||||
virtual bool unshareDownloadDirectory();
|
||||
virtual bool shareDownloadDirectory(bool share);
|
||||
|
||||
virtual void setRememberHashFilesDuration(uint32_t days) ;
|
||||
virtual uint32_t rememberHashFilesDuration() const ;
|
||||
|
@ -190,10 +190,8 @@ class RsFiles
|
||||
virtual bool rememberHashFiles() const =0;
|
||||
virtual void setRememberHashFiles(bool) =0;
|
||||
|
||||
virtual void setShareDownloadDirectory(bool value) = 0;
|
||||
virtual bool getShareDownloadDirectory() = 0;
|
||||
virtual bool shareDownloadDirectory() = 0;
|
||||
virtual bool unshareDownloadDirectory() = 0;
|
||||
virtual bool shareDownloadDirectory(bool share) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
@ -244,6 +244,12 @@ void QuickStartWizard::on_pushButtonSharesRemove_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
void QuickStartWizard::on_shareIncomingDirectory_clicked()
|
||||
{
|
||||
rsFiles->shareDownloadDirectory(ui.shareIncomingDirectory->isChecked());
|
||||
loadShare();
|
||||
}
|
||||
|
||||
void QuickStartWizard::loadShare()
|
||||
{
|
||||
std::cerr << "ShareManager:: In load !!!!!" << std::endl ;
|
||||
@ -252,6 +258,8 @@ void QuickStartWizard::loadShare()
|
||||
std::list<SharedDirInfo> dirs;
|
||||
rsFiles->getSharedDirectories(dirs);
|
||||
|
||||
ui.shareIncomingDirectory->setChecked(rsFiles->getShareDownloadDirectory());
|
||||
|
||||
/* get a link to the table */
|
||||
QTableWidget *listWidget = ui.shareddirList;
|
||||
|
||||
|
@ -51,6 +51,7 @@ private:
|
||||
bool messageBoxOk(QString);
|
||||
|
||||
private Q_SLOTS:
|
||||
void on_shareIncomingDirectory_clicked();
|
||||
void on_pushButtonSharesRemove_clicked();
|
||||
void on_pushButtonSharesAdd_clicked();
|
||||
void on_pushButtonSystemExit_clicked();
|
||||
|
@ -158,7 +158,7 @@ p, li { white-space: pre-wrap; }
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageWelcome">
|
||||
<property name="styleSheet">
|
||||
@ -681,21 +681,21 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="pushButtonSharesAdd">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="pushButtonSharesRemove">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<item row="3" column="2">
|
||||
<spacer name="horizontalSpacer_16">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -708,7 +708,7 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<item row="4" column="0" colspan="3">
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@ -721,6 +721,13 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="shareIncomingDirectory">
|
||||
<property name="text">
|
||||
<string>Automatically share incoming directory (Recommended)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -34,20 +34,13 @@ DirectoriesPage::DirectoriesPage(QWidget * parent, Qt::WFlags flags)
|
||||
ui.setupUi(this);
|
||||
setAttribute(Qt::WA_QuitOnClose, false);
|
||||
|
||||
if (rsFiles->getShareDownloadDirectory())
|
||||
{
|
||||
ui.checkBox->setChecked(true); /* signal not emitted */
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.checkBox->setChecked(false); /* signal not emitted */
|
||||
}
|
||||
ui.checkBox->setChecked(rsFiles->getShareDownloadDirectory()); /* signal not emitted */
|
||||
|
||||
uint32_t t = rsFiles->rememberHashFilesDuration() ;
|
||||
bool b = rsFiles->rememberHashFiles() ;
|
||||
uint32_t t = rsFiles->rememberHashFilesDuration() ;
|
||||
bool b = rsFiles->rememberHashFiles() ;
|
||||
|
||||
ui.rememberHashesSB->setValue(t) ;
|
||||
ui.rememberHashesCB->setChecked(b) ;
|
||||
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() ) );
|
||||
@ -57,7 +50,7 @@ DirectoriesPage::DirectoriesPage(QWidget * parent, Qt::WFlags flags)
|
||||
connect(ui.rememberHashesCB, SIGNAL(toggled(bool)), this, SLOT(toggleRememberHashes(bool)));
|
||||
connect(ui.rememberHashesSB, SIGNAL(valueChanged(int)), this, SLOT(setRememberHashesDuration(int)));
|
||||
|
||||
/* Hide platform specific features */
|
||||
/* Hide platform specific features */
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
#endif
|
||||
@ -114,29 +107,7 @@ bool DirectoriesPage::save(QString &errmsg)
|
||||
/* this is usefull especially when shared incoming files is
|
||||
* default option and when the user don't check/uncheck the
|
||||
* checkBox, so no signal is emitted to update the shared list */
|
||||
if (ui.checkBox->isChecked())
|
||||
{
|
||||
std::list<SharedDirInfo>::const_iterator it;
|
||||
std::list<SharedDirInfo> dirs;
|
||||
rsFiles->getSharedDirectories(dirs);
|
||||
|
||||
bool found = false ;
|
||||
for(std::list<SharedDirInfo>::const_iterator it(dirs.begin());it!=dirs.end();++it)
|
||||
if((*it).filename == rsFiles->getDownloadDirectory())
|
||||
{
|
||||
found=true ;
|
||||
break ;
|
||||
}
|
||||
if(!found)
|
||||
rsFiles->shareDownloadDirectory();
|
||||
|
||||
rsFiles->setShareDownloadDirectory(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
rsFiles->unshareDownloadDirectory();
|
||||
rsFiles->setShareDownloadDirectory(false);
|
||||
}
|
||||
rsFiles->shareDownloadDirectory(ui.checkBox->isChecked());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -182,19 +153,7 @@ void DirectoriesPage::setIncomingDirectory()
|
||||
rsFiles->setDownloadDirectory(dir);
|
||||
if (ui.checkBox->isChecked())
|
||||
{
|
||||
std::list<SharedDirInfo>::const_iterator it;
|
||||
std::list<SharedDirInfo> dirs;
|
||||
rsFiles->getSharedDirectories(dirs);
|
||||
|
||||
bool found = false ;
|
||||
for(std::list<SharedDirInfo>::const_iterator it(dirs.begin());it!=dirs.end();++it)
|
||||
if((*it).filename == rsFiles->getDownloadDirectory())
|
||||
{
|
||||
found=true ;
|
||||
break ;
|
||||
}
|
||||
if(!found)
|
||||
rsFiles->shareDownloadDirectory();
|
||||
rsFiles->shareDownloadDirectory(true);
|
||||
}
|
||||
}
|
||||
load();
|
||||
@ -214,29 +173,6 @@ void DirectoriesPage::setPartialsDirectory()
|
||||
|
||||
void DirectoriesPage::shareDownloadDirectory(int state)
|
||||
{
|
||||
if (state == Qt::Checked)
|
||||
{
|
||||
std::list<SharedDirInfo>::const_iterator it;
|
||||
std::list<SharedDirInfo> dirs;
|
||||
rsFiles->getSharedDirectories(dirs);
|
||||
|
||||
bool found = false ;
|
||||
for(std::list<SharedDirInfo>::const_iterator it(dirs.begin());it!=dirs.end();++it)
|
||||
if((*it).filename == rsFiles->getDownloadDirectory())
|
||||
{
|
||||
found=true ;
|
||||
break ;
|
||||
}
|
||||
if(!found)
|
||||
rsFiles->shareDownloadDirectory();
|
||||
|
||||
rsFiles->setShareDownloadDirectory(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
rsFiles->unshareDownloadDirectory();
|
||||
rsFiles->setShareDownloadDirectory(false);
|
||||
}
|
||||
rsFiles->shareDownloadDirectory(state == Qt::Checked);
|
||||
load();
|
||||
}
|
||||
|
||||
|
Binary file not shown.
@ -2782,12 +2782,12 @@ p, li { white-space: pre-wrap; }
|
||||
<translation>Durchsuchen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui/settings/DirectoriesPage.cpp" line="+179"/>
|
||||
<location filename="../gui/settings/DirectoriesPage.cpp" line="+148"/>
|
||||
<source>Set Incoming Directory</source>
|
||||
<translation>Ordner für eingehende Dateien</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+28"/>
|
||||
<location line="+16"/>
|
||||
<source>Set Partials Directory</source>
|
||||
<translation>Ordner für temporäre Dateien</translation>
|
||||
</message>
|
||||
@ -2838,7 +2838,7 @@ Das ist nützlich, wenn Du eine externe Festplatte freigibst und die Datei nicht
|
||||
<message>
|
||||
<location line="+62"/>
|
||||
<source>Automatically share incoming directory (Recommended)</source>
|
||||
<translation>Eingehende Ordner automatisch freigeben</translation>
|
||||
<translation>Eingehende Ordner automatisch freigeben (Empfohlen)</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
@ -8893,20 +8893,20 @@ p, li { white-space: pre-wrap; }
|
||||
<message>
|
||||
<location line="+120"/>
|
||||
<location line="+269"/>
|
||||
<location line="+235"/>
|
||||
<location line="+242"/>
|
||||
<source>Next ></source>
|
||||
<translation>Weiter ></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="-494"/>
|
||||
<location line="-501"/>
|
||||
<location line="+269"/>
|
||||
<location line="+235"/>
|
||||
<location line="+242"/>
|
||||
<location line="+205"/>
|
||||
<source>Exit</source>
|
||||
<translation>Beenden</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="-649"/>
|
||||
<location line="-656"/>
|
||||
<source>For best performance, RetroShare needs to know a little about your connection to the internet.</source>
|
||||
<translation>Für die beste Leistung muß RetroShare ein wenig über Deine Internetverbindung wissen.</translation>
|
||||
</message>
|
||||
@ -8953,13 +8953,13 @@ p, li { white-space: pre-wrap; }
|
||||
</message>
|
||||
<message>
|
||||
<location line="+94"/>
|
||||
<location line="+235"/>
|
||||
<location line="+242"/>
|
||||
<location line="+205"/>
|
||||
<source>< Back</source>
|
||||
<translation>< Zurück</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="-358"/>
|
||||
<location line="-365"/>
|
||||
<source><!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; }
|
||||
@ -9004,7 +9004,12 @@ p, li { white-space: pre-wrap; }
|
||||
<translation>Entfernen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+137"/>
|
||||
<location line="+33"/>
|
||||
<source>Automatically share incoming directory (Recommended)</source>
|
||||
<translation>Eingehende Ordner automatisch freigeben (Empfohlen)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+111"/>
|
||||
<source><!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; }
|
||||
@ -9085,7 +9090,7 @@ p, li { white-space: pre-wrap; }
|
||||
<translation>Warnung!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui/QuickStartWizard.ui" line="-775"/>
|
||||
<location filename="../gui/QuickStartWizard.ui" line="-782"/>
|
||||
<source><!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; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user