* Switched to new rsFiles interface.

* Updated Transfers/SharedFiles/Messages.. etc Dialogs.
 * Disabled 'Recommendation Lists' for the moment.
 * updated Interface files.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@631 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2008-07-02 16:59:56 +00:00
parent be392405e8
commit 32973f0838
13 changed files with 215 additions and 213 deletions

View File

@ -47,6 +47,7 @@
#include "rsiface/rsiface.h"
#include "rsiface/rspeers.h"
#include "rsiface/rsfiles.h"
#include "gui/connect/InviteDialog.h"
#include "gui/connect/AddFriendDialog.h"
@ -455,8 +456,7 @@ void MainWindow::addSharedDirectory()
std::string dir = qdir.toStdString();
if (dir != "")
{
rsicontrol -> ConfigAddSharedDir(dir);
//rsicontrol -> ConfigSave();
rsFiles -> addSharedDirectory(dir);
}
}

View File

@ -28,6 +28,7 @@
#include "rsiface/rsiface.h"
#include "rsiface/rspeers.h"
#include "rsiface/rsmsgs.h"
#include "rsiface/rsfiles.h"
#include <sstream>
#include <QContextMenuEvent>
@ -282,7 +283,7 @@ void MessagesDialog::getallrecommended()
for(fit = fnames.begin(), hit = hashes.begin(), sit = sizes.begin();
fit != fnames.end(); fit++, hit++, sit++)
{
rsicontrol -> FileRequest(*fit, *hit, *sit, "");
rsFiles -> FileRequest(*fit, *hit, *sit, "", 0);
}
}

View File

@ -21,7 +21,7 @@
#include <rshare.h>
#include "rsiface/rsiface.h"
#include "rsiface/rsfiles.h"
#include "DirectoriesDialog.h"
@ -56,12 +56,9 @@ DirectoriesDialog::save(QString &errmsg)
/** Loads the settings for this page */
void DirectoriesDialog::load()
{
/* get the shared directories */
rsiface->lockData(); /* Lock Interface */
std::list<std::string>::const_iterator it;
const std::list<std::string> &dirs = rsiface->getConfig().sharedDirList;
std::list<std::string> dirs;
rsFiles->getSharedDirectories(dirs);
/* get a link to the table */
QListWidget *listWidget = ui.dirList;
@ -75,9 +72,7 @@ void DirectoriesDialog::load()
listWidget->addItem(QString::fromStdString(*it));
}
ui.incomingDir->setText(QString::fromStdString(rsiface->getConfig().incomingDir));
rsiface->unlockData(); /* UnLock Interface */
ui.incomingDir->setText(QString::fromStdString(rsFiles->getDownloadDirectory()));
listWidget->update(); /* update display */
@ -96,7 +91,7 @@ void DirectoriesDialog::addShareDirectory()
std::string dir = qdir.toStdString();
if (dir != "")
{
rsicontrol -> ConfigAddSharedDir(dir);
rsFiles->addSharedDirectory(dir);
load();
}
}
@ -109,7 +104,7 @@ void DirectoriesDialog::removeShareDirectory()
QListWidgetItem *qdir = listWidget -> currentItem();
if (qdir)
{
rsicontrol -> ConfigRemoveSharedDir( qdir->text().toStdString());
rsFiles->removeSharedDirectory( qdir->text().toStdString());
load();
}
}
@ -122,7 +117,7 @@ void DirectoriesDialog::setIncomingDirectory()
std::string dir = qdir.toStdString();
if (dir != "")
{
rsicontrol->ConfigSetIncomingDir(dir);
rsFiles->setDownloadDirectory(dir);
}
load();
}

View File

@ -24,6 +24,7 @@
#include "SearchDialog.h"
#include "rsiface/rsiface.h"
#include "rsiface/rsexpr.h"
#include "rsiface/rsfiles.h"
#include <iostream>
#include <sstream>
@ -226,10 +227,10 @@ void SearchDialog::download()
// call the download
if (item->text(SR_ID_COL) != "Local")
{
rsicontrol -> FileRequest((item->text(SR_NAME_COL)).toStdString(),
rsFiles -> FileRequest((item->text(SR_NAME_COL)).toStdString(),
(item->text(SR_HASH_COL)).toStdString(),
(item->text(SR_SIZE_COL)).toInt(),
"");
"", 0);
}
else
{
@ -378,7 +379,7 @@ void SearchDialog::advancedSearch(Expression* expression)
/* call to core */
std::list<FileDetail> results;
rsicontrol -> SearchBoolExp(expression, results);
rsFiles -> SearchBoolExp(expression, results);
/* abstraction to allow reusee of tree rendering code */
resultsToTree((advSearchDialog->getSearchAsString()).toStdString(), results);
@ -412,7 +413,7 @@ void SearchDialog::searchKeywords()
std::list<FileDetail> initialResults;
std::list<FileDetail> * finalResults = 0;
rsicontrol -> SearchKeywords(words, initialResults);
rsFiles -> SearchKeywords(words, initialResults);
/* which extensions do we use? */
QString qExt, qName;
int extIndex;

View File

@ -25,6 +25,7 @@
#include "rsiface/rsiface.h"
#include "rsiface/rspeers.h"
#include "rsiface/rsfiles.h"
#include "rsiface/RemoteDirModel.h"
#include "util/RsAction.h"
#include "msgs/ChanMsgDialog.h"
@ -135,7 +136,7 @@ SharedFilesDialog::SharedFilesDialog(QWidget *parent)
void SharedFilesDialog::checkUpdate()
{
/* update */
if (rsicontrol->InDirectoryCheck())
if (rsFiles->InDirectoryCheck())
{
ui.hashLabel->setPixmap(QPixmap(IMAGE_HASH_BUSY));
/*QMovie *movie = new QMovie(IMAGE_PROGRESS);
@ -153,7 +154,7 @@ void SharedFilesDialog::checkUpdate()
void SharedFilesDialog::forceCheck()
{
rsicontrol->ForceDirectoryCheck();
rsFiles->ForceDirectoryCheck();
return;
}
@ -191,32 +192,6 @@ void SharedFilesDialog::downloadRemoteSelected()
}
void SharedFilesDialog::addMsgRemoteSelected()
{
/* call back to the model (which does all the interfacing? */
std::cerr << "Recommending Files";
std::cerr << std::endl;
QItemSelectionModel *qism = ui.remoteDirTreeView->selectionModel();
model -> recommendSelected(qism->selectedIndexes());
}
void SharedFilesDialog::recommendfile()
{
/* call back to the model (which does all the interfacing? */
std::cerr << "Recommending Files";
std::cerr << std::endl;
QItemSelectionModel *qism = ui.localDirTreeView->selectionModel();
localModel -> recommendSelected(qism->selectedIndexes());
}
void SharedFilesDialog::playselectedfiles()
{
@ -235,7 +210,7 @@ void SharedFilesDialog::playselectedfiles()
for(it = paths.begin(); it != paths.end(); it++)
{
std::string fullpath;
rsicontrol->ConvertSharedFilePath(*it, fullpath);
rsFiles->ConvertSharedFilePath(*it, fullpath);
fullpaths.push_back(QString::fromStdString(fullpath));
std::cerr << "Playing: " << fullpath;
@ -246,6 +221,34 @@ void SharedFilesDialog::playselectedfiles()
}
#if 0
void SharedFilesDialog::addMsgRemoteSelected()
{
/* call back to the model (which does all the interfacing? */
std::cerr << "Recommending Files";
std::cerr << std::endl;
QItemSelectionModel *qism = ui.remoteDirTreeView->selectionModel();
model -> recommendSelected(qism->selectedIndexes());
}
void SharedFilesDialog::recommendfile()
{
/* call back to the model (which does all the interfacing? */
std::cerr << "Recommending Files";
std::cerr << std::endl;
QItemSelectionModel *qism = ui.localDirTreeView->selectionModel();
localModel -> recommendSelected(qism->selectedIndexes());
}
void SharedFilesDialog::recommendFileSetOnly()
@ -284,9 +287,9 @@ void SharedFilesDialog::recommendFilesTo( std::string rsid )
nMsgDialog->close();
}
void SharedFilesDialog::recommendFilesToMsg( std::string rsid )
void SharedFilesDialog::recommendFilesToMsg( std::string rsid )
{
recommendFileSetOnly();
@ -308,8 +311,9 @@ void SharedFilesDialog::recommendFilesToMsg( std::string rsid )
nMsgDialog->show();
}
#endif
void SharedFilesDialog::openfile()
{
/* call back to the model (which does all the interfacing? */
@ -364,9 +368,9 @@ void SharedFilesDialog::shareddirtreeWidgetCostumPopupMenu( QPoint point )
openfolderAct = new QAction(QIcon(IMAGE_DOWNLOAD), tr( "Play File(s)" ), this );
connect( openfolderAct , SIGNAL( triggered() ), this, SLOT( playselectedfiles() ) );
#if 0
openfileAct = new QAction(QIcon(IMAGE_ATTACHMENT), tr( "Add to Recommend List" ), this );
connect( openfileAct , SIGNAL( triggered() ), this, SLOT( recommendfile() ) );
/* now we're going to ask who to recommend it to...
* First Level.
@ -416,12 +420,14 @@ void SharedFilesDialog::shareddirtreeWidgetCostumPopupMenu( QPoint point )
/* create list of ids */
}
#endif
contextMnu2.addAction( openfolderAct);
contextMnu2.addAction( openfileAct);
contextMnu2.addSeparator();
contextMnu2.addMenu( recMenu);
contextMnu2.addMenu( msgMenu);
//contextMnu2.addAction( openfileAct);
//contextMnu2.addSeparator();
//contextMnu2.addMenu( recMenu);
//contextMnu2.addMenu( msgMenu);
contextMnu2.exec( mevent2->globalPos() );

View File

@ -56,16 +56,16 @@ private slots:
void shareddirtreeWidgetCostumPopupMenu( QPoint point );
void downloadRemoteSelected();
void addMsgRemoteSelected();
// void addMsgRemoteSelected();
void recommendfile();
// void recommendfile();
void playselectedfiles();
void openfile();
void openfolder();
void recommendFileSetOnly();
void recommendFilesTo( std::string rsid );
void recommendFilesToMsg( std::string rsid );
// void recommendFileSetOnly();
// void recommendFilesTo( std::string rsid );
// void recommendFilesToMsg( std::string rsid );
signals:
void playFiles(QStringList files);

View File

@ -36,7 +36,7 @@
#include <QStandardItemModel>
#include <sstream>
#include "rsiface/rsiface.h"
#include "rsiface/rsfiles.h"
/* Images for context menu icons */
#define IMAGE_INFO ":/images/fileinfo.png"
@ -198,9 +198,7 @@ void TransfersDialog::playSelectedTransfer()
std::cerr << "TransfersDialog::playSelectedTransfer()" << std::endl;
/* get the shared directories */
rsiface->lockData(); /* Lock Interface */
std::string incomingdir = rsiface->getConfig().incomingDir;
rsiface->unlockData(); /* UnLock Interface */
std::string incomingdir = rsFiles->getDownloadDirectory();
/* create the List of Files */
QStringList playList;
@ -371,33 +369,32 @@ void TransfersDialog::insertTransfers()
delUploadItem(i);
}
//nun aktuelle DownloadListe hinzufügen
rsiface->lockData(); /* Lock Interface */
std::list<FileTransferInfo>::const_iterator it;
const std::list<FileTransferInfo> &transfers = rsiface->getTransferList();
/* get the download and upload lists */
std::list<std::string> downHashes;
std::list<std::string> upHashes;
rsFiles->FileDownloads(downHashes);
rsFiles->FileUploads(upHashes);
uint32_t dlCount = 0;
uint32_t ulCount = 0;
for(it = transfers.begin(); it != transfers.end(); it++)
std::list<std::string>::iterator it;
for(it = downHashes.begin(); it != downHashes.end(); it++)
{
FileInfo info;
if (!rsFiles->FileDetails(*it, 0, info))
{
continue;
}
symbol = "";
coreId = "";
name = QString::fromStdString(it->fname);
sources = QString::fromStdString(it->source);
coreId = QString::fromStdString(info.hash);
name = QString::fromStdString(info.fname);
sources = QString::fromStdString(info.source);
/* Replace ID with HASH -> as thats what we need to cancel! */
//std::ostringstream out;
//out << it->id;
//coreId = QString::fromStdString(it->hashout.str());
coreId = QString::fromStdString(it->hash);
sources = QString::fromStdString(it->source);
switch(it->downloadStatus)
switch(info.downloadStatus)
{
/******** XXX HAND CODED!
@ -427,35 +424,78 @@ void TransfersDialog::insertTransfers()
}
dlspeed = it->tfRate * 1024.0;
fileSize = it->size;
completed = it->transfered;
progress = it->transfered * 100.0 / it->size;
remaining = (it->size - it->transfered) / (it->tfRate * 1024.0);
dlspeed = info.tfRate * 1024.0;
fileSize = info.size;
completed = info.transfered;
progress = info.transfered * 100.0 / info.size;
remaining = (info.size - info.transfered) / (info.tfRate * 1024.0);
if (it->download)
{
addItem(symbol, name, coreId, fileSize, progress,
dlspeed, sources, status, completed, remaining);
addItem(symbol, name, coreId, fileSize, progress,
dlspeed, sources, status, completed, remaining);
/* if found in selectedIds -> select again */
if (selectedIds.end() != std::find(selectedIds.begin(), selectedIds.end(), it->hash))
{
selection->select(DLListModel->index(dlCount, 0),
QItemSelectionModel::Rows | QItemSelectionModel::SelectCurrent);
}
dlCount++;
}
else
/* if found in selectedIds -> select again */
if (selectedIds.end() != std::find(selectedIds.begin(), selectedIds.end(), info.hash))
{
addUploadItem(symbol, name, coreId, fileSize, progress,
dlspeed, sources, status, completed, remaining);
ulCount++;
selection->select(DLListModel->index(dlCount, 0),
QItemSelectionModel::Rows | QItemSelectionModel::SelectCurrent);
}
dlCount++;
}
rsiface->unlockData(); /* UnLock Interface */
for(it = upHashes.begin(); it != upHashes.end(); it++)
{
FileInfo info;
if (!rsFiles->FileDetails(*it, 0, info))
{
continue;
}
symbol = "";
coreId = QString::fromStdString(info.hash);
name = QString::fromStdString(info.fname);
sources = QString::fromStdString(info.source);
switch(info.downloadStatus)
{
/******** XXX HAND CODED!
#define FT_STATE_FAILED 0
#define FT_STATE_OKAY 1
#define FT_STATE_WAITING 2
#define FT_STATE_DOWNLOADING 3
#define FT_STATE_COMPLETE 4
*******************/
case 0: /* FAILED */
status = "Failed";
break;
case 1: /* OKAY */
status = "Okay";
break;
case 2: /* WAITING */
status = "Waiting";
break;
case 3: /* DOWNLOADING */
status = "Downloading";
break;
case 4: /* COMPLETE */
default:
status = "Complete";
break;
}
dlspeed = info.tfRate * 1024.0;
fileSize = info.size;
completed = info.transfered;
progress = info.transfered * 100.0 / info.size;
remaining = (info.size - info.transfered) / (info.tfRate * 1024.0);
addUploadItem(symbol, name, coreId, fileSize, progress,
dlspeed, sources, status, completed, remaining);
ulCount++;
}
}
void TransfersDialog::cancel()
@ -468,17 +508,15 @@ void TransfersDialog::cancel()
* but otherwise, not exact filename .... BUG
*/
std::string name = (qname.trimmed()).toStdString();
// TODO
rsicontrol->FileCancel(name, id, 0); /* name, *hash*, size */
//std::cerr << "TranfersDialog::cancel(): " << name << ":" << id << ":" << 0 << std::endl;
rsFiles->FileCancel(id); /* hash */
}
}
}
void TransfersDialog::clearcompleted()
{
std::cerr << "TransfersDialog::clearcompleted()" << std::endl;
rsicontrol->FileClearCompleted();
std::cerr << "TransfersDialog::clearcompleted()" << std::endl;
rsFiles->FileClearCompleted();
}
double TransfersDialog::getProgress(int row, QStandardItemModel *model)

View File

@ -1,6 +1,7 @@
#include "RemoteDirModel.h"
#include "rsiface.h"
#include "rsfiles.h"
#include <QPalette>
@ -35,7 +36,7 @@
else
flags |= DIR_FLAGS_LOCAL;
if (!rsicontrol->RequestDirDetails(ref, details, flags))
if (!rsFiles->RequestDirDetails(ref, details, flags))
{
/* error */
#ifdef RDM_DEBUG
@ -82,7 +83,7 @@
else
flags |= DIR_FLAGS_LOCAL;
if (!rsicontrol->RequestDirDetails(ref, details, flags))
if (!rsFiles->RequestDirDetails(ref, details, flags))
{
#ifdef RDM_DEBUG
std::cerr << "lookup failed -> 0";
@ -135,7 +136,7 @@
else
flags |= DIR_FLAGS_LOCAL;
if (!rsicontrol->RequestDirDetails(ref, details, flags))
if (!rsFiles->RequestDirDetails(ref, details, flags))
{
return QVariant();
}
@ -387,7 +388,7 @@
else
flags |= DIR_FLAGS_LOCAL;
if (!rsicontrol->RequestDirDetails(ref, details, flags))
if (!rsFiles->RequestDirDetails(ref, details, flags))
{
#ifdef RDM_DEBUG
std::cerr << "lookup failed -> invalid";
@ -451,7 +452,7 @@
else
flags |= DIR_FLAGS_LOCAL;
if (!rsicontrol->RequestDirDetails(ref, details, flags))
if (!rsFiles->RequestDirDetails(ref, details, flags))
{
#ifdef RDM_DEBUG
std::cerr << "Failed Lookup -> invalid";
@ -496,7 +497,7 @@
else
flags |= DIR_FLAGS_LOCAL;
if (!rsicontrol->RequestDirDetails(ref, details, flags))
if (!rsFiles->RequestDirDetails(ref, details, flags))
{
return (Qt::ItemIsSelectable); // Error.
}
@ -555,7 +556,7 @@ void RemoteDirModel::update (const QModelIndex &index )
{
//std::cerr << "Directory Request(" << id << ") : ";
//std::cerr << path << std::endl;
//rsicontrol -> RequestDirectories(id, path, 1);
//rsFiles -> RequestDirectories(id, path, 1);
}
void RemoteDirModel::downloadSelected(QModelIndexList list)
@ -587,19 +588,25 @@ void RemoteDirModel::downloadSelected(QModelIndexList list)
continue; /* don't try to download local stuff */
}
if (!rsicontrol->RequestDirDetails(ref, details, flags))
if (!rsFiles->RequestDirDetails(ref, details, flags))
{
continue;
}
/* only request if it is a file */
if (details.type == DIR_TYPE_FILE)
{
rsicontrol -> FileRequest(details.name, details.hash,
details.count, "");
rsFiles -> FileRequest(details.name, details.hash,
details.count, "", 0);
}
}
}
/****************************************************************************
* OLD RECOMMEND SYSTEM - DISABLED
*
*/
#if 0
void RemoteDirModel::recommendSelected(QModelIndexList list)
{
@ -626,7 +633,7 @@ void RemoteDirModel::recommendSelected(QModelIndexList list)
flags |= DIR_FLAGS_LOCAL;
}
if (!rsicontrol->RequestDirDetails(ref, details, flags))
if (!rsFiles->RequestDirDetails(ref, details, flags))
{
continue;
}
@ -637,7 +644,7 @@ void RemoteDirModel::recommendSelected(QModelIndexList list)
std::cerr << "Size: " << details.count << std::endl;
std::cerr << "Path: " << details.path << std::endl;
rsicontrol -> FileRecommend(details.name, details.hash, details.count);
rsFiles -> FileRecommend(details.name, details.hash, details.count);
}
std::cerr << "::::::::::::Done FileRecommend" << std::endl;
}
@ -650,7 +657,7 @@ void RemoteDirModel::recommendSelectedOnly(QModelIndexList list)
{
std::cerr << "Cannot recommend remote! (should download)" << std::endl;
}
rsicontrol->ClearInRecommend();
rsFiles->ClearInRecommend();
/* Fire off requests */
QModelIndexList::iterator it;
@ -670,7 +677,7 @@ void RemoteDirModel::recommendSelectedOnly(QModelIndexList list)
flags |= DIR_FLAGS_LOCAL;
}
if (!rsicontrol->RequestDirDetails(ref, details, flags))
if (!rsFiles->RequestDirDetails(ref, details, flags))
{
continue;
}
@ -681,15 +688,20 @@ void RemoteDirModel::recommendSelectedOnly(QModelIndexList list)
std::cerr << "Size: " << details.count << std::endl;
std::cerr << "Path: " << details.path << std::endl;
rsicontrol -> FileRecommend(details.name, details.hash, details.count);
rsicontrol -> SetInRecommend(details.name, true);
rsFiles -> FileRecommend(details.name, details.hash, details.count);
rsFiles -> SetInRecommend(details.name, true);
}
std::cerr << "::::::::::::Done FileRecommend" << std::endl;
}
#endif
/****************************************************************************
* OLD RECOMMEND SYSTEM - DISABLED
******/
void RemoteDirModel::openSelected(QModelIndexList list)
{
recommendSelected(list);
//recommendSelected(list);
}
@ -711,7 +723,7 @@ void RemoteDirModel::getFilePaths(QModelIndexList list, std::list<std::string> &
uint32_t flags = DIR_FLAGS_DETAILS;
flags |= DIR_FLAGS_LOCAL;
if (!rsicontrol->RequestDirDetails(ref, details, flags))
if (!rsFiles->RequestDirDetails(ref, details, flags))
{
std::cerr << "getFilePaths() Bad Request" << std::endl;
continue;

View File

@ -38,8 +38,12 @@ class RemoteDirModel : public QAbstractItemModel
/* Callback from GUI */
void downloadSelected(QModelIndexList list);
#if 0 /****** REMOVED ******/
void recommendSelected(QModelIndexList list);
void recommendSelectedOnly(QModelIndexList list);
#endif
void openSelected(QModelIndexList list);
void getFilePaths(QModelIndexList list, std::list<std::string> &fullpaths);

View File

@ -345,23 +345,6 @@ void NotifyQt::displayChannels()
void NotifyQt::displayTransfers()
{
iface->lockData(); /* Lock Interface */
std::list<FileTransferInfo>::const_iterator it;
const std::list<FileTransferInfo> &tlist = iface->getTransferList();
for(it = tlist.begin(); it != tlist.end(); it++)
{
std::ostringstream out;
out << "Transfer: ";
out << it ->fname << " ";
out << it ->path << " ";
out << std::endl;
std::cerr << out.str();
}
iface->unlockData(); /* UnLock Interface */
/* Do the GUI */
if (tDialog)
tDialog->insertTransfers();

View File

@ -33,12 +33,10 @@
#include "rsiface/rstypes.h"
std::ostream &operator<<(std::ostream &out, const MessageInfo &info);
std::ostream &operator<<(std::ostream &out, const ChatInfo &info);
class RsFiles;
extern RsFiles *rsFiles;
class Expression;
const uint32_t RS_FILE_CTRL_PAUSE = 0x0100;
const uint32_t RS_FILE_CTRL_START = 0x0200;
@ -70,9 +68,9 @@ virtual ~RsFiles() { return; }
*/
/* get Details of File Transfers */
virtual bool FileDownloads(std::list<std::string> &hashs)= 0;
virtual bool FileUploads(std::list<std::string> &hashs)= 0;
virtual bool FileDetails(std::string hash, uint32_t hintflags, FileInfo &info)= 0;
virtual bool FileDownloads(std::list<std::string> &hashs) = 0;
virtual bool FileUploads(std::list<std::string> &hashs) = 0;
virtual bool FileDetails(std::string hash, uint32_t hintflags, FileInfo &info) = 0;
/*
@ -81,11 +79,11 @@ virtual bool FileDetails(std::string hash, uint32_t hintflags, FileInfo &info)=
*/
virtual int FileRequest(std::string fname, std::string hash,
uint32_t size, std::string dest, uint32_t flags)= 0;
virtual int FileCancel(std::string hash)= 0;
virtual int FileControl(std::string hash, uint32_t flags)= 0;
virtual int FileClearCompleted()= 0;
virtual bool FileRequest(std::string fname, std::string hash,
uint32_t size, std::string dest, uint32_t flags) = 0;
virtual bool FileCancel(std::string hash) = 0;
virtual bool FileControl(std::string hash, uint32_t flags) = 0;
virtual bool FileClearCompleted() = 0;
/*
@ -101,12 +99,12 @@ virtual int FileClearCompleted()= 0;
*/
/* Access ftExtraList - Details */
virtual int ExtraFileAdd(std::string fname, std::string hash, uint32_t size,
uint32_t period, uint32_t flags)= 0;
virtual int ExtraFileRemove(std::string hash, uin32_t flags)= 0;
virtual bool ExtraFileAdd(std::string fname, std::string hash, uint32_t size,
uint32_t period, uint32_t flags) = 0;
virtual bool ExtraFileRemove(std::string hash, uint32_t flags) = 0;
virtual bool ExtraFileHash(std::string localpath,
uint32_t period, uint32_t flags)= 0;
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info)= 0;
uint32_t period, uint32_t flags) = 0;
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info) = 0;
/*
@ -114,20 +112,29 @@ virtual bool ExtraFileStatus(std::string localpath, FileInfo &info)= 0;
*/
/* Directory Listing / Search Interface */
virtual int RequestDirDetails(std::string uid, std::string path, DirDetails &details)= 0;
virtual int RequestDirDetails(void *ref, DirDetails &details, uint32_t flags)= 0;
virtual int RequestDirDetails(std::string uid, std::string path, DirDetails &details) = 0;
virtual int RequestDirDetails(void *ref, DirDetails &details, uint32_t flags) = 0;
virtual int SearchKeywords(std::list<std::string> keywords, std::list<FileDetail> &results)= 0;
virtual int SearchBoolExp(Expression * exp, std::list<FileDetail> &results)= 0;
virtual int SearchKeywords(std::list<std::string> keywords, std::list<FileDetail> &results) = 0;
virtual int SearchBoolExp(Expression * exp, std::list<FileDetail> &results) = 0;
/*
* 5) Utility Functions.
* 5) Directory Control / Shared Files Utility Functions.
*/
virtual bool ConvertSharedFilePath(std::string path, std::string &fullpath) = 0;
virtual void ForceDirectoryCheck() = 0;
virtual bool InDirectoryCheck() = 0;
virtual void setDownloadDirectory(std::string path) = 0;
virtual void setPartialsDirectory(std::string path) = 0;
virtual std::string getDownloadDirectory() = 0;
virtual std::string getPartialsDirectory() = 0;
virtual bool getSharedDirectories(std::list<std::string> &dirs) = 0;
virtual bool addSharedDirectory(std::string dir) = 0;
virtual bool removeSharedDirectory(std::string dir) = 0;
};

View File

@ -34,9 +34,7 @@
class NotifyBase;
class RsIface;
class RsControl;
//class RsServer;
class RsInit;
class Expression;
/* declare single RsIface for everyone to use! */
@ -88,9 +86,6 @@ public:
virtual void lockData() = 0;
virtual void unlockData() = 0;
const std::list<FileTransferInfo> &getTransferList()
{ return mTransferList; }
const std::list<FileInfo> &getRecommendList()
{ return mRecommendList; }
@ -129,7 +124,6 @@ bool hasChanged(DataFlags set); /* resets it */
void fillLists(); /* create some dummy data to display */
/* Internals */
std::list<FileTransferInfo> mTransferList;
std::list<FileInfo> mRecommendList;
bool mChanged[NumOfFlags];
@ -156,34 +150,6 @@ virtual ~RsControl() { return; }
/* Real Startup Fn */
virtual int StartupRetroShare(RsInit *config) = 0;
/****************************************/
/* Directory Actions */
virtual int RequestDirDetails(std::string uid, std::string path, DirDetails &details) = 0;
virtual int RequestDirDetails(void *ref, DirDetails &details, uint32_t flags) = 0;
virtual bool ConvertSharedFilePath(std::string path, std::string &fullpath) = 0;
virtual void ForceDirectoryCheck() = 0;
virtual bool InDirectoryCheck() = 0;
/****************************************/
/* Search Actions */
virtual int SearchKeywords(std::list<std::string> keywords, std::list<FileDetail> &results) = 0;
virtual int SearchBoolExp(Expression *exp, std::list<FileDetail> &results) = 0;
/****************************************/
/* Actions For Upload/Download */
//virtual int FileDelete(std::string uId, std::string fname) = 0;
//virtual int FileMove(std::string uId, std::string src, std::string dest) = 0;
virtual int FileRecommend(std::string fname, std::string hash, int size) = 0;
virtual int FileRequest(std::string fname, std::string hash, uint32_t size, std::string dest) = 0;
virtual int FileCancel(std::string fname, std::string hash, uint32_t size) = 0;
// Transfer control.
virtual int FileClearCompleted() = 0;
virtual int FileSetBandwidthTotals(float outkB, float inkB) = 0;
/****************************************/
/* Flagging Persons / Channels / Files in or out of a set (CheckLists) */
@ -201,16 +167,8 @@ virtual int ClearInRecommend() = 0;
virtual bool IsInChat(std::string id) = 0; /* friend : chat msgs */
virtual bool IsInMsg(std::string id) = 0; /* friend : msg recpts*/
/****************************************/
/* RsIface Networking */
//virtual int NetworkDHTActive(bool active) = 0;
//virtual int NetworkUPnPActive(bool active) = 0;
/****************************************/
/* Config */
virtual int ConfigAddSharedDir( std::string dir ) = 0;
virtual int ConfigRemoveSharedDir( std::string dir ) = 0;
virtual int ConfigSetIncomingDir( std::string dir ) = 0;
virtual int ConfigSetDataRates( int total, int indiv ) = 0;
virtual int ConfigGetDataRates( float &inKb, float &outKb) = 0;

View File

@ -105,9 +105,6 @@ class RsConfig
std::string ownId;
std::string ownName;
std::list<std::string> sharedDirList;
std::string incomingDir;
std::string localAddr;
int localPort;
std::string extAddr;