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

View File

@ -28,6 +28,7 @@
#include "rsiface/rsiface.h" #include "rsiface/rsiface.h"
#include "rsiface/rspeers.h" #include "rsiface/rspeers.h"
#include "rsiface/rsmsgs.h" #include "rsiface/rsmsgs.h"
#include "rsiface/rsfiles.h"
#include <sstream> #include <sstream>
#include <QContextMenuEvent> #include <QContextMenuEvent>
@ -282,7 +283,7 @@ void MessagesDialog::getallrecommended()
for(fit = fnames.begin(), hit = hashes.begin(), sit = sizes.begin(); for(fit = fnames.begin(), hit = hashes.begin(), sit = sizes.begin();
fit != fnames.end(); fit++, hit++, sit++) 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 <rshare.h>
#include "rsiface/rsiface.h" #include "rsiface/rsfiles.h"
#include "DirectoriesDialog.h" #include "DirectoriesDialog.h"
@ -56,12 +56,9 @@ DirectoriesDialog::save(QString &errmsg)
/** Loads the settings for this page */ /** Loads the settings for this page */
void DirectoriesDialog::load() void DirectoriesDialog::load()
{ {
/* get the shared directories */
rsiface->lockData(); /* Lock Interface */
std::list<std::string>::const_iterator it; 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 */ /* get a link to the table */
QListWidget *listWidget = ui.dirList; QListWidget *listWidget = ui.dirList;
@ -75,9 +72,7 @@ void DirectoriesDialog::load()
listWidget->addItem(QString::fromStdString(*it)); listWidget->addItem(QString::fromStdString(*it));
} }
ui.incomingDir->setText(QString::fromStdString(rsiface->getConfig().incomingDir)); ui.incomingDir->setText(QString::fromStdString(rsFiles->getDownloadDirectory()));
rsiface->unlockData(); /* UnLock Interface */
listWidget->update(); /* update display */ listWidget->update(); /* update display */
@ -96,7 +91,7 @@ void DirectoriesDialog::addShareDirectory()
std::string dir = qdir.toStdString(); std::string dir = qdir.toStdString();
if (dir != "") if (dir != "")
{ {
rsicontrol -> ConfigAddSharedDir(dir); rsFiles->addSharedDirectory(dir);
load(); load();
} }
} }
@ -109,7 +104,7 @@ void DirectoriesDialog::removeShareDirectory()
QListWidgetItem *qdir = listWidget -> currentItem(); QListWidgetItem *qdir = listWidget -> currentItem();
if (qdir) if (qdir)
{ {
rsicontrol -> ConfigRemoveSharedDir( qdir->text().toStdString()); rsFiles->removeSharedDirectory( qdir->text().toStdString());
load(); load();
} }
} }
@ -122,7 +117,7 @@ void DirectoriesDialog::setIncomingDirectory()
std::string dir = qdir.toStdString(); std::string dir = qdir.toStdString();
if (dir != "") if (dir != "")
{ {
rsicontrol->ConfigSetIncomingDir(dir); rsFiles->setDownloadDirectory(dir);
} }
load(); load();
} }

View File

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

View File

@ -25,6 +25,7 @@
#include "rsiface/rsiface.h" #include "rsiface/rsiface.h"
#include "rsiface/rspeers.h" #include "rsiface/rspeers.h"
#include "rsiface/rsfiles.h"
#include "rsiface/RemoteDirModel.h" #include "rsiface/RemoteDirModel.h"
#include "util/RsAction.h" #include "util/RsAction.h"
#include "msgs/ChanMsgDialog.h" #include "msgs/ChanMsgDialog.h"
@ -135,7 +136,7 @@ SharedFilesDialog::SharedFilesDialog(QWidget *parent)
void SharedFilesDialog::checkUpdate() void SharedFilesDialog::checkUpdate()
{ {
/* update */ /* update */
if (rsicontrol->InDirectoryCheck()) if (rsFiles->InDirectoryCheck())
{ {
ui.hashLabel->setPixmap(QPixmap(IMAGE_HASH_BUSY)); ui.hashLabel->setPixmap(QPixmap(IMAGE_HASH_BUSY));
/*QMovie *movie = new QMovie(IMAGE_PROGRESS); /*QMovie *movie = new QMovie(IMAGE_PROGRESS);
@ -153,7 +154,7 @@ void SharedFilesDialog::checkUpdate()
void SharedFilesDialog::forceCheck() void SharedFilesDialog::forceCheck()
{ {
rsicontrol->ForceDirectoryCheck(); rsFiles->ForceDirectoryCheck();
return; 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() void SharedFilesDialog::playselectedfiles()
{ {
@ -235,7 +210,7 @@ void SharedFilesDialog::playselectedfiles()
for(it = paths.begin(); it != paths.end(); it++) for(it = paths.begin(); it != paths.end(); it++)
{ {
std::string fullpath; std::string fullpath;
rsicontrol->ConvertSharedFilePath(*it, fullpath); rsFiles->ConvertSharedFilePath(*it, fullpath);
fullpaths.push_back(QString::fromStdString(fullpath)); fullpaths.push_back(QString::fromStdString(fullpath));
std::cerr << "Playing: " << 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() void SharedFilesDialog::recommendFileSetOnly()
@ -308,6 +311,7 @@ void SharedFilesDialog::recommendFilesToMsg( std::string rsid )
nMsgDialog->show(); nMsgDialog->show();
} }
#endif
void SharedFilesDialog::openfile() void SharedFilesDialog::openfile()
@ -364,10 +368,10 @@ void SharedFilesDialog::shareddirtreeWidgetCostumPopupMenu( QPoint point )
openfolderAct = new QAction(QIcon(IMAGE_DOWNLOAD), tr( "Play File(s)" ), this ); openfolderAct = new QAction(QIcon(IMAGE_DOWNLOAD), tr( "Play File(s)" ), this );
connect( openfolderAct , SIGNAL( triggered() ), this, SLOT( playselectedfiles() ) ); connect( openfolderAct , SIGNAL( triggered() ), this, SLOT( playselectedfiles() ) );
#if 0
openfileAct = new QAction(QIcon(IMAGE_ATTACHMENT), tr( "Add to Recommend List" ), this ); openfileAct = new QAction(QIcon(IMAGE_ATTACHMENT), tr( "Add to Recommend List" ), this );
connect( openfileAct , SIGNAL( triggered() ), this, SLOT( recommendfile() ) ); connect( openfileAct , SIGNAL( triggered() ), this, SLOT( recommendfile() ) );
/* now we're going to ask who to recommend it to... /* now we're going to ask who to recommend it to...
* First Level. * First Level.
* *
@ -416,12 +420,14 @@ void SharedFilesDialog::shareddirtreeWidgetCostumPopupMenu( QPoint point )
/* create list of ids */ /* create list of ids */
} }
#endif
contextMnu2.addAction( openfolderAct); contextMnu2.addAction( openfolderAct);
contextMnu2.addAction( openfileAct); //contextMnu2.addAction( openfileAct);
contextMnu2.addSeparator(); //contextMnu2.addSeparator();
contextMnu2.addMenu( recMenu); //contextMnu2.addMenu( recMenu);
contextMnu2.addMenu( msgMenu); //contextMnu2.addMenu( msgMenu);
contextMnu2.exec( mevent2->globalPos() ); contextMnu2.exec( mevent2->globalPos() );

View File

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

View File

@ -36,7 +36,7 @@
#include <QStandardItemModel> #include <QStandardItemModel>
#include <sstream> #include <sstream>
#include "rsiface/rsiface.h" #include "rsiface/rsfiles.h"
/* Images for context menu icons */ /* Images for context menu icons */
#define IMAGE_INFO ":/images/fileinfo.png" #define IMAGE_INFO ":/images/fileinfo.png"
@ -198,9 +198,7 @@ void TransfersDialog::playSelectedTransfer()
std::cerr << "TransfersDialog::playSelectedTransfer()" << std::endl; std::cerr << "TransfersDialog::playSelectedTransfer()" << std::endl;
/* get the shared directories */ /* get the shared directories */
rsiface->lockData(); /* Lock Interface */ std::string incomingdir = rsFiles->getDownloadDirectory();
std::string incomingdir = rsiface->getConfig().incomingDir;
rsiface->unlockData(); /* UnLock Interface */
/* create the List of Files */ /* create the List of Files */
QStringList playList; QStringList playList;
@ -372,32 +370,31 @@ void TransfersDialog::insertTransfers()
} }
//nun aktuelle DownloadListe hinzufügen /* get the download and upload lists */
rsiface->lockData(); /* Lock Interface */ std::list<std::string> downHashes;
std::list<std::string> upHashes;
std::list<FileTransferInfo>::const_iterator it; rsFiles->FileDownloads(downHashes);
const std::list<FileTransferInfo> &transfers = rsiface->getTransferList(); rsFiles->FileUploads(upHashes);
uint32_t dlCount = 0; uint32_t dlCount = 0;
uint32_t ulCount = 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 = ""; symbol = "";
coreId = ""; coreId = QString::fromStdString(info.hash);
name = QString::fromStdString(it->fname); name = QString::fromStdString(info.fname);
sources = QString::fromStdString(it->source); sources = QString::fromStdString(info.source);
/* Replace ID with HASH -> as thats what we need to cancel! */ switch(info.downloadStatus)
//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)
{ {
/******** XXX HAND CODED! /******** XXX HAND CODED!
@ -427,19 +424,17 @@ void TransfersDialog::insertTransfers()
} }
dlspeed = it->tfRate * 1024.0; dlspeed = info.tfRate * 1024.0;
fileSize = it->size; fileSize = info.size;
completed = it->transfered; completed = info.transfered;
progress = it->transfered * 100.0 / it->size; progress = info.transfered * 100.0 / info.size;
remaining = (it->size - it->transfered) / (it->tfRate * 1024.0); remaining = (info.size - info.transfered) / (info.tfRate * 1024.0);
if (it->download)
{
addItem(symbol, name, coreId, fileSize, progress, addItem(symbol, name, coreId, fileSize, progress,
dlspeed, sources, status, completed, remaining); dlspeed, sources, status, completed, remaining);
/* if found in selectedIds -> select again */ /* if found in selectedIds -> select again */
if (selectedIds.end() != std::find(selectedIds.begin(), selectedIds.end(), it->hash)) if (selectedIds.end() != std::find(selectedIds.begin(), selectedIds.end(), info.hash))
{ {
selection->select(DLListModel->index(dlCount, 0), selection->select(DLListModel->index(dlCount, 0),
QItemSelectionModel::Rows | QItemSelectionModel::SelectCurrent); QItemSelectionModel::Rows | QItemSelectionModel::SelectCurrent);
@ -447,17 +442,62 @@ void TransfersDialog::insertTransfers()
} }
dlCount++; dlCount++;
} }
else
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, addUploadItem(symbol, name, coreId, fileSize, progress,
dlspeed, sources, status, completed, remaining); dlspeed, sources, status, completed, remaining);
ulCount++; ulCount++;
} }
} }
rsiface->unlockData(); /* UnLock Interface */
}
void TransfersDialog::cancel() void TransfersDialog::cancel()
{ {
for(int i = 0; i <= DLListModel->rowCount(); i++) { for(int i = 0; i <= DLListModel->rowCount(); i++) {
@ -468,9 +508,7 @@ void TransfersDialog::cancel()
* but otherwise, not exact filename .... BUG * but otherwise, not exact filename .... BUG
*/ */
std::string name = (qname.trimmed()).toStdString(); std::string name = (qname.trimmed()).toStdString();
// TODO rsFiles->FileCancel(id); /* hash */
rsicontrol->FileCancel(name, id, 0); /* name, *hash*, size */
//std::cerr << "TranfersDialog::cancel(): " << name << ":" << id << ":" << 0 << std::endl;
} }
} }
} }
@ -478,7 +516,7 @@ void TransfersDialog::cancel()
void TransfersDialog::clearcompleted() void TransfersDialog::clearcompleted()
{ {
std::cerr << "TransfersDialog::clearcompleted()" << std::endl; std::cerr << "TransfersDialog::clearcompleted()" << std::endl;
rsicontrol->FileClearCompleted(); rsFiles->FileClearCompleted();
} }
double TransfersDialog::getProgress(int row, QStandardItemModel *model) double TransfersDialog::getProgress(int row, QStandardItemModel *model)

View File

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

View File

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

View File

@ -345,23 +345,6 @@ void NotifyQt::displayChannels()
void NotifyQt::displayTransfers() 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 */ /* Do the GUI */
if (tDialog) if (tDialog)
tDialog->insertTransfers(); tDialog->insertTransfers();

View File

@ -33,12 +33,10 @@
#include "rsiface/rstypes.h" #include "rsiface/rstypes.h"
std::ostream &operator<<(std::ostream &out, const MessageInfo &info);
std::ostream &operator<<(std::ostream &out, const ChatInfo &info);
class RsFiles; class RsFiles;
extern RsFiles *rsFiles; extern RsFiles *rsFiles;
class Expression;
const uint32_t RS_FILE_CTRL_PAUSE = 0x0100; const uint32_t RS_FILE_CTRL_PAUSE = 0x0100;
const uint32_t RS_FILE_CTRL_START = 0x0200; const uint32_t RS_FILE_CTRL_START = 0x0200;
@ -81,11 +79,11 @@ virtual bool FileDetails(std::string hash, uint32_t hintflags, FileInfo &info)=
*/ */
virtual int FileRequest(std::string fname, std::string hash, virtual bool FileRequest(std::string fname, std::string hash,
uint32_t size, std::string dest, uint32_t flags) = 0; uint32_t size, std::string dest, uint32_t flags) = 0;
virtual int FileCancel(std::string hash)= 0; virtual bool FileCancel(std::string hash) = 0;
virtual int FileControl(std::string hash, uint32_t flags)= 0; virtual bool FileControl(std::string hash, uint32_t flags) = 0;
virtual int FileClearCompleted()= 0; virtual bool FileClearCompleted() = 0;
/* /*
@ -101,9 +99,9 @@ virtual int FileClearCompleted()= 0;
*/ */
/* Access ftExtraList - Details */ /* Access ftExtraList - Details */
virtual int ExtraFileAdd(std::string fname, std::string hash, uint32_t size, virtual bool ExtraFileAdd(std::string fname, std::string hash, uint32_t size,
uint32_t period, uint32_t flags) = 0; uint32_t period, uint32_t flags) = 0;
virtual int ExtraFileRemove(std::string hash, uin32_t flags)= 0; virtual bool ExtraFileRemove(std::string hash, uint32_t flags) = 0;
virtual bool ExtraFileHash(std::string localpath, virtual bool ExtraFileHash(std::string localpath,
uint32_t period, uint32_t flags) = 0; uint32_t period, uint32_t flags) = 0;
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info) = 0; virtual bool ExtraFileStatus(std::string localpath, FileInfo &info) = 0;
@ -121,13 +119,22 @@ virtual int SearchKeywords(std::list<std::string> keywords, std::list<FileDetail
virtual int SearchBoolExp(Expression * exp, 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 bool ConvertSharedFilePath(std::string path, std::string &fullpath) = 0;
virtual void ForceDirectoryCheck() = 0; virtual void ForceDirectoryCheck() = 0;
virtual bool InDirectoryCheck() = 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 NotifyBase;
class RsIface; class RsIface;
class RsControl; class RsControl;
//class RsServer;
class RsInit; class RsInit;
class Expression;
/* declare single RsIface for everyone to use! */ /* declare single RsIface for everyone to use! */
@ -88,9 +86,6 @@ public:
virtual void lockData() = 0; virtual void lockData() = 0;
virtual void unlockData() = 0; virtual void unlockData() = 0;
const std::list<FileTransferInfo> &getTransferList()
{ return mTransferList; }
const std::list<FileInfo> &getRecommendList() const std::list<FileInfo> &getRecommendList()
{ return mRecommendList; } { return mRecommendList; }
@ -129,7 +124,6 @@ bool hasChanged(DataFlags set); /* resets it */
void fillLists(); /* create some dummy data to display */ void fillLists(); /* create some dummy data to display */
/* Internals */ /* Internals */
std::list<FileTransferInfo> mTransferList;
std::list<FileInfo> mRecommendList; std::list<FileInfo> mRecommendList;
bool mChanged[NumOfFlags]; bool mChanged[NumOfFlags];
@ -156,34 +150,6 @@ virtual ~RsControl() { return; }
/* Real Startup Fn */ /* Real Startup Fn */
virtual int StartupRetroShare(RsInit *config) = 0; 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) */ /* 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 IsInChat(std::string id) = 0; /* friend : chat msgs */
virtual bool IsInMsg(std::string id) = 0; /* friend : msg recpts*/ 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 */ /* 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 ConfigSetDataRates( int total, int indiv ) = 0;
virtual int ConfigGetDataRates( float &inKb, float &outKb) = 0; virtual int ConfigGetDataRates( float &inKb, float &outKb) = 0;

View File

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