diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index 547b89f58..ebf6b5a1d 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -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); } } diff --git a/retroshare-gui/src/gui/MessagesDialog.cpp b/retroshare-gui/src/gui/MessagesDialog.cpp index 76c1f0ef4..87b750b96 100644 --- a/retroshare-gui/src/gui/MessagesDialog.cpp +++ b/retroshare-gui/src/gui/MessagesDialog.cpp @@ -28,6 +28,7 @@ #include "rsiface/rsiface.h" #include "rsiface/rspeers.h" #include "rsiface/rsmsgs.h" +#include "rsiface/rsfiles.h" #include #include @@ -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); } } diff --git a/retroshare-gui/src/gui/Preferences/DirectoriesDialog.cpp b/retroshare-gui/src/gui/Preferences/DirectoriesDialog.cpp index 1bd708d7c..75084d718 100644 --- a/retroshare-gui/src/gui/Preferences/DirectoriesDialog.cpp +++ b/retroshare-gui/src/gui/Preferences/DirectoriesDialog.cpp @@ -21,7 +21,7 @@ #include -#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::const_iterator it; - const std::list &dirs = rsiface->getConfig().sharedDirList; + std::list 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(); } diff --git a/retroshare-gui/src/gui/SearchDialog.cpp b/retroshare-gui/src/gui/SearchDialog.cpp index d8d78f48c..19205fd88 100644 --- a/retroshare-gui/src/gui/SearchDialog.cpp +++ b/retroshare-gui/src/gui/SearchDialog.cpp @@ -24,6 +24,7 @@ #include "SearchDialog.h" #include "rsiface/rsiface.h" #include "rsiface/rsexpr.h" +#include "rsiface/rsfiles.h" #include #include @@ -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 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 initialResults; std::list * finalResults = 0; - rsicontrol -> SearchKeywords(words, initialResults); + rsFiles -> SearchKeywords(words, initialResults); /* which extensions do we use? */ QString qExt, qName; int extIndex; diff --git a/retroshare-gui/src/gui/SharedFilesDialog.cpp b/retroshare-gui/src/gui/SharedFilesDialog.cpp index 149a2f03f..beb44874e 100644 --- a/retroshare-gui/src/gui/SharedFilesDialog.cpp +++ b/retroshare-gui/src/gui/SharedFilesDialog.cpp @@ -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() ); diff --git a/retroshare-gui/src/gui/SharedFilesDialog.h b/retroshare-gui/src/gui/SharedFilesDialog.h index 3d4189896..25d51038b 100644 --- a/retroshare-gui/src/gui/SharedFilesDialog.h +++ b/retroshare-gui/src/gui/SharedFilesDialog.h @@ -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); diff --git a/retroshare-gui/src/gui/TransfersDialog.cpp b/retroshare-gui/src/gui/TransfersDialog.cpp index c3a0ad2ee..865ec66c1 100644 --- a/retroshare-gui/src/gui/TransfersDialog.cpp +++ b/retroshare-gui/src/gui/TransfersDialog.cpp @@ -36,7 +36,7 @@ #include #include -#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::const_iterator it; - const std::list &transfers = rsiface->getTransferList(); + /* get the download and upload lists */ + std::list downHashes; + std::list 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::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) diff --git a/retroshare-gui/src/rsiface/RemoteDirModel.cpp b/retroshare-gui/src/rsiface/RemoteDirModel.cpp index b0b431ba4..7ca459659 100644 --- a/retroshare-gui/src/rsiface/RemoteDirModel.cpp +++ b/retroshare-gui/src/rsiface/RemoteDirModel.cpp @@ -1,6 +1,7 @@ #include "RemoteDirModel.h" -#include "rsiface.h" +#include "rsfiles.h" + #include @@ -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 & 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; diff --git a/retroshare-gui/src/rsiface/RemoteDirModel.h b/retroshare-gui/src/rsiface/RemoteDirModel.h index af5a08687..e3aae4f94 100644 --- a/retroshare-gui/src/rsiface/RemoteDirModel.h +++ b/retroshare-gui/src/rsiface/RemoteDirModel.h @@ -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 &fullpaths); diff --git a/retroshare-gui/src/rsiface/notifyqt.cpp b/retroshare-gui/src/rsiface/notifyqt.cpp index 53d6f6b18..d6c0638e8 100644 --- a/retroshare-gui/src/rsiface/notifyqt.cpp +++ b/retroshare-gui/src/rsiface/notifyqt.cpp @@ -345,23 +345,6 @@ void NotifyQt::displayChannels() void NotifyQt::displayTransfers() { - iface->lockData(); /* Lock Interface */ - - std::list::const_iterator it; - const std::list &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(); diff --git a/retroshare-gui/src/rsiface/rsfiles.h b/retroshare-gui/src/rsiface/rsfiles.h index acceb3ced..0a7d0b640 100644 --- a/retroshare-gui/src/rsiface/rsfiles.h +++ b/retroshare-gui/src/rsiface/rsfiles.h @@ -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 &hashs)= 0; -virtual bool FileUploads(std::list &hashs)= 0; -virtual bool FileDetails(std::string hash, uint32_t hintflags, FileInfo &info)= 0; +virtual bool FileDownloads(std::list &hashs) = 0; +virtual bool FileUploads(std::list &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 keywords, std::list &results)= 0; -virtual int SearchBoolExp(Expression * exp, std::list &results)= 0; +virtual int SearchKeywords(std::list keywords, std::list &results) = 0; +virtual int SearchBoolExp(Expression * exp, std::list &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 &dirs) = 0; +virtual bool addSharedDirectory(std::string dir) = 0; +virtual bool removeSharedDirectory(std::string dir) = 0; + }; diff --git a/retroshare-gui/src/rsiface/rsiface.h b/retroshare-gui/src/rsiface/rsiface.h index 7951ddcc2..0f479dce5 100644 --- a/retroshare-gui/src/rsiface/rsiface.h +++ b/retroshare-gui/src/rsiface/rsiface.h @@ -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 &getTransferList() - { return mTransferList; } - const std::list &getRecommendList() { return mRecommendList; } @@ -129,7 +124,6 @@ bool hasChanged(DataFlags set); /* resets it */ void fillLists(); /* create some dummy data to display */ /* Internals */ - std::list mTransferList; std::list 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 keywords, std::list &results) = 0; -virtual int SearchBoolExp(Expression *exp, std::list &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; diff --git a/retroshare-gui/src/rsiface/rstypes.h b/retroshare-gui/src/rsiface/rstypes.h index 85ffb488f..c7cbed251 100644 --- a/retroshare-gui/src/rsiface/rstypes.h +++ b/retroshare-gui/src/rsiface/rstypes.h @@ -105,9 +105,6 @@ class RsConfig std::string ownId; std::string ownName; - std::list sharedDirList; - std::string incomingDir; - std::string localAddr; int localPort; std::string extAddr;