From e07783ac2ba0ad42869141e9b7ea90f60f5fdef6 Mon Sep 17 00:00:00 2001 From: drbob Date: Mon, 31 Mar 2008 18:37:50 +0000 Subject: [PATCH] Various Gui improvements: * Added fallback to only if peer is unknown in LinkCloud. * Added CheckFiles, and display status icon to SharedFiles. * Fixed SMPlayer startup and added play slot in Main Window. * Added Play Files to Local Shared Files. (context menu) * Added Play File to completed File Transfers. (context menu) * Ensured that selected Transfer stays selected. * Corrected Download State enumeration * Renamed Peer Details/ Authenticate to Make Friend / Peer Details * Removed Network View from Application Window. * Mods to RemoteDirModel to get Paths from files. * updated Rs Interface files. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@450 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/ApplicationWindow.cpp | 8 +- retroshare-gui/src/gui/LinksDialog.cpp | 6 + retroshare-gui/src/gui/MainWindow.cpp | 38 ++++-- retroshare-gui/src/gui/MainWindow.h | 4 + retroshare-gui/src/gui/NetworkDialog.cpp | 4 +- retroshare-gui/src/gui/SharedFilesDialog.cpp | 69 +++++++++- retroshare-gui/src/gui/SharedFilesDialog.h | 9 +- retroshare-gui/src/gui/SharedFilesDialog.ui | 105 ++++++--------- retroshare-gui/src/gui/TransfersDialog.cpp | 124 ++++++++++++++++-- retroshare-gui/src/gui/TransfersDialog.h | 5 +- retroshare-gui/src/rsiface/RemoteDirModel.cpp | 50 +++++++ retroshare-gui/src/rsiface/RemoteDirModel.h | 4 + retroshare-gui/src/rsiface/rsiface.h | 4 + retroshare-gui/src/rsiface/rsnotify.h | 5 - 14 files changed, 323 insertions(+), 112 deletions(-) diff --git a/retroshare-gui/src/gui/ApplicationWindow.cpp b/retroshare-gui/src/gui/ApplicationWindow.cpp index cb1dbd92f..674f1929d 100644 --- a/retroshare-gui/src/gui/ApplicationWindow.cpp +++ b/retroshare-gui/src/gui/ApplicationWindow.cpp @@ -105,9 +105,9 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags) ui.stackPages->add(gamesDialog = new GamesDialog(ui.stackPages), createPageAction(QIcon(IMAGE_GAMES), tr("Games Launcher"), grp)); - NetworkView *networkView = NULL; - ui.stackPages->add(networkView = new NetworkView(ui.stackPages), - createPageAction(QIcon(IMAGE_NETWORK), tr("Network View"), grp)); + //NetworkView *networkView = NULL; + //ui.stackPages->add(networkView = new NetworkView(ui.stackPages), + // createPageAction(QIcon(IMAGE_NETWORK), tr("Network View"), grp)); PhotoDialog *photoDialog = NULL; ui.stackPages->add(photoDialog = new PhotoDialog(ui.stackPages), @@ -126,7 +126,7 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WFlags flags) connect(grp, SIGNAL(triggered(QAction *)), ui.stackPages, SLOT(showPage(QAction *))); /* Create and bind the messenger button */ - addAction(new QAction(QIcon(IMAGE_SMPLAYER), tr("SMPlayer"), ui.toolBar), SLOT(showsmplayer())); + //addAction(new QAction(QIcon(IMAGE_SMPLAYER), tr("SMPlayer"), ui.toolBar), SLOT(showsmplayer())); } diff --git a/retroshare-gui/src/gui/LinksDialog.cpp b/retroshare-gui/src/gui/LinksDialog.cpp index 6037efd50..d00662387 100644 --- a/retroshare-gui/src/gui/LinksDialog.cpp +++ b/retroshare-gui/src/gui/LinksDialog.cpp @@ -384,6 +384,12 @@ void LinksDialog::updateLinks() QString timestamp = qtime.toString("yyyy-MM-dd hh:mm:ss"); QString peerLabel = QString::fromStdString(rsPeers->getPeerName(cit->id)); + if (peerLabel == "") + { + peerLabel = "<"; + peerLabel += QString::fromStdString(cit->id); + peerLabel = ">"; + } peerLabel += " "; peerLabel += timestamp; child -> setText(2, peerLabel); diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index 28a6b0fd8..d06c11cb7 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -101,6 +101,8 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags) ui.setupUi(this); setWindowTitle(tr("RetroShare %1").arg(retroshareVersion())); + + mSMPlayer = NULL; /* Hide Console frame */ //showConsoleFrame(false); @@ -197,7 +199,9 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags) connect(grp, SIGNAL(triggered(QAction *)), ui.stackPages, SLOT(showPage(QAction *))); - + // Allow to play files from SharedFilesDialog. + connect(sharedfilesDialog, SIGNAL(playFiles( QStringList )), this, SLOT(playFiles( QStringList ))); + connect(transfersDialog, SIGNAL(playFiles( QStringList )), this, SLOT(playFiles( QStringList ))); #ifdef RS_RELEASE_VERSION addAction(new QAction(QIcon(IMAGE_BLOCK), tr("Unfinished"), ui.toolBar), SLOT(showApplWindow())); @@ -280,7 +284,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags) menu->addAction(_bandwidthAct); #endif menu->addAction(_prefsAct); - //menu->addAction(_smplayerAct); + menu->addAction(_smplayerAct); menu->addSeparator(); menu->addAction(tr("Minimize"), this, SLOT(showMinimized())); menu->addAction(tr("Maximize"), this, SLOT(showMaximized())); @@ -461,7 +465,7 @@ MainWindow::~MainWindow() delete _prefsAct; delete _bandwidthGraph; delete _messengerwindowAct; - //delete _smplayerAct; + delete _smplayerAct; } /** Create and bind actions to events. Setup for initial @@ -479,8 +483,8 @@ void MainWindow::createActions() _messengerwindowAct = new QAction(QIcon(IMAGE_RSM16), tr("Open Messenger"), this); connect(_messengerwindowAct, SIGNAL(triggered()),this, SLOT(showMessengerWindow())); - //_smplayerAct = new QAction(QIcon(IMAGE_SMPLAYER), tr("SMPlayer"), this); - //connect(_smplayerAct, SIGNAL(triggered()),this, SLOT(showsmplayer())); + _smplayerAct = new QAction(QIcon(IMAGE_SMPLAYER), tr("SMPlayer"), this); + connect(_smplayerAct, SIGNAL(triggered()),this, SLOT(showsmplayer())); //connect(ui.btntoggletoolbox, SIGNAL(toggled(bool)), this, SLOT(showToolboxFrame(bool))); @@ -640,20 +644,26 @@ void MainWindow::startqcheckers() } -/** Shows smplayer */ -void MainWindow::showsmplayer() +/** Shows smplayer */ +void MainWindow::showsmplayer() { static SMPlayer * smplayer = 0; - if (smplayer == 0) { - smplayer = new SMPlayer(QString::null, this); - /*connect(smplayer->gui(), SIGNAL(quitSolicited()), - smplayer->gui(), SLOT(hide()));*/ - } - smplayer->gui()->show(); - + if (mSMPlayer == 0) + { + mSMPlayer = new SMPlayer(QString::null, this); + } + mSMPlayer->gui()->show(); + } +void MainWindow::playFiles(QStringList files) +{ + showsmplayer(); + mSMPlayer->gui()->openFiles(files); +} + + void MainWindow::showabout() { static HelpDialog *helpdlg = new HelpDialog(this); diff --git a/retroshare-gui/src/gui/MainWindow.h b/retroshare-gui/src/gui/MainWindow.h index ca5c02d61..d61725d46 100644 --- a/retroshare-gui/src/gui/MainWindow.h +++ b/retroshare-gui/src/gui/MainWindow.h @@ -54,6 +54,8 @@ #include "../config/rsharesettings.h" +class SMPlayer; + class MainWindow : public QMainWindow { Q_OBJECT @@ -97,6 +99,7 @@ public: MessengerWindow *messengerWindow; ApplicationWindow *applicationWindow; + SMPlayer * mSMPlayer; public slots: /** Called when this dialog is to be displayed */ @@ -107,6 +110,7 @@ public slots: void startgammon(); void startqcheckers(); + void playFiles(QStringList files); private slots: diff --git a/retroshare-gui/src/gui/NetworkDialog.cpp b/retroshare-gui/src/gui/NetworkDialog.cpp index b0ec17eec..b8445a197 100644 --- a/retroshare-gui/src/gui/NetworkDialog.cpp +++ b/retroshare-gui/src/gui/NetworkDialog.cpp @@ -119,7 +119,7 @@ void NetworkDialog::connecttreeWidgetCostumPopupMenu( QPoint point ) QMenu contextMnu( this ); QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier ); - peerdetailsAct = new QAction(QIcon(IMAGE_PEERDETAILS), tr( "Peer Details / Authenticate " ), this ); + peerdetailsAct = new QAction(QIcon(IMAGE_PEERDETAILS), tr( "Make Friend / Peer Details" ), this ); connect( peerdetailsAct , SIGNAL( triggered() ), this, SLOT( peerdetails() ) ); //authAct = new QAction(QIcon(IMAGE_AUTH), tr( "Authenticate" ), this ); @@ -472,4 +472,4 @@ void NetworkDialog::displayInfoLogMenu(const QPoint& pos) { myLogMenu.addAction(ui.actionClearLog); // XXX: Why mapToGlobal() is not enough? myLogMenu.exec(mapToGlobal(pos)+QPoint(0,320)); -} \ No newline at end of file +} diff --git a/retroshare-gui/src/gui/SharedFilesDialog.cpp b/retroshare-gui/src/gui/SharedFilesDialog.cpp index 8f068f6eb..ca821c87f 100644 --- a/retroshare-gui/src/gui/SharedFilesDialog.cpp +++ b/retroshare-gui/src/gui/SharedFilesDialog.cpp @@ -39,9 +39,12 @@ #include #include #include +#include /* Images for context menu icons */ #define IMAGE_DOWNLOAD ":/images/start.png" +#define IMAGE_HASH_BUSY ":/images/settings.png" +#define IMAGE_HASH_DONE ":/images/folder_green.png" /** Constructor */ SharedFilesDialog::SharedFilesDialog(QWidget *parent) @@ -49,6 +52,9 @@ SharedFilesDialog::SharedFilesDialog(QWidget *parent) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); + + connect(ui.checkButton, SIGNAL(clicked()), this, SLOT(forceCheck())); + connect( ui.localDirTreeView, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( shareddirtreeWidgetCostumPopupMenu( QPoint ) ) ); @@ -107,12 +113,39 @@ SharedFilesDialog::SharedFilesDialog(QWidget *parent) ui.remoteDirTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection); ui.localDirTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection); + QTimer *timer = new QTimer(this); + timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate())); + timer->start(1000); + /* Hide platform specific features */ #ifdef Q_WS_WIN #endif } +void SharedFilesDialog::checkUpdate() +{ + /* update */ + if (rsicontrol->InDirectoryCheck()) + { + ui.hashLabel->setPixmap(QPixmap(IMAGE_HASH_BUSY)); + } + else + { + ui.hashLabel->setPixmap(QPixmap(IMAGE_HASH_DONE)); + } + + return; +} + + +void SharedFilesDialog::forceCheck() +{ + rsicontrol->ForceDirectoryCheck(); + return; +} + + void SharedFilesDialog::shareddirtreeviewCostumPopupMenu( QPoint point ) { @@ -172,6 +205,34 @@ void SharedFilesDialog::recommendfile() localModel -> recommendSelected(qism->selectedIndexes()); } + +void SharedFilesDialog::playselectedfiles() +{ + /* call back to the model (which does all the interfacing? */ + + std::cerr << "SharedFilesDialog::playselectedfiles()"; + std::cerr << std::endl; + + QItemSelectionModel *qism = ui.localDirTreeView->selectionModel(); + + std::list paths; + localModel -> getFilePaths(qism->selectedIndexes(), paths); + + std::list::iterator it; + QStringList fullpaths; + for(it = paths.begin(); it != paths.end(); it++) + { + std::string fullpath; + rsicontrol->ConvertSharedFilePath(*it, fullpath); + fullpaths.push_back(QString::fromStdString(fullpath)); + + std::cerr << "Playing: " << fullpath; + std::cerr << std::endl; + } + + playFiles(fullpaths); +} + @@ -288,12 +349,13 @@ void SharedFilesDialog::shareddirtreeWidgetCostumPopupMenu( QPoint point ) QMenu contextMnu2( this ); QMouseEvent *mevent2 = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier ); + openfolderAct = new QAction( tr( "Play File(s)" ), this ); + connect( openfolderAct , SIGNAL( triggered() ), this, SLOT( playselectedfiles() ) ); + openfileAct = new QAction( tr( "Add to Recommend List" ), this ); connect( openfileAct , SIGNAL( triggered() ), this, SLOT( recommendfile() ) ); - // openfolderAct = new QAction( tr( "Play File" ), this ); - // connect( openfolderAct , SIGNAL( triggered() ), this, SLOT( openfile() ) ); - // + /* now we're going to ask who to recommend it to... * First Level. * @@ -341,6 +403,7 @@ void SharedFilesDialog::shareddirtreeWidgetCostumPopupMenu( QPoint point ) } + contextMnu2.addAction( openfolderAct); contextMnu2.addAction( openfileAct); contextMnu2.addMenu( recMenu); contextMnu2.addMenu( msgMenu); diff --git a/retroshare-gui/src/gui/SharedFilesDialog.h b/retroshare-gui/src/gui/SharedFilesDialog.h index f94da1e06..ea91c862e 100644 --- a/retroshare-gui/src/gui/SharedFilesDialog.h +++ b/retroshare-gui/src/gui/SharedFilesDialog.h @@ -45,10 +45,11 @@ public: void preModDirectories(bool update_local); void ModDirectories(bool update_local); - - private slots: + void checkUpdate(); + void forceCheck(); + /** Create the context popup menu and it's submenus */ void shareddirtreeviewCostumPopupMenu( QPoint point ); @@ -58,6 +59,7 @@ private slots: void addMsgRemoteSelected(); void recommendfile(); + void playselectedfiles(); void openfile(); void openfolder(); @@ -65,6 +67,9 @@ private slots: void recommendFilesTo( std::string rsid ); void recommendFilesToMsg( std::string rsid ); +signals: + void playFiles(QStringList files); + private: /** Define the popup menus for the Context menu */ QMenu* contextMnu; diff --git a/retroshare-gui/src/gui/SharedFilesDialog.ui b/retroshare-gui/src/gui/SharedFilesDialog.ui index e03334902..ba5419675 100644 --- a/retroshare-gui/src/gui/SharedFilesDialog.ui +++ b/retroshare-gui/src/gui/SharedFilesDialog.ui @@ -5,8 +5,8 @@ 0 0 - 467 - 309 + 445 + 401 @@ -499,18 +499,6 @@ Qt::NoContextMenu - - 6 - - - 1 - - - 6 - - - 1 - 1 @@ -518,59 +506,10 @@ 1 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + + 0 @@ -612,9 +551,39 @@ p, li { white-space: pre-wrap; } + + + + Qt::Horizontal + + + + 271 + 20 + + + + + + + + check files + + + + + + + + + + :/qss/black/checkBox_selected.png + + + - + diff --git a/retroshare-gui/src/gui/TransfersDialog.cpp b/retroshare-gui/src/gui/TransfersDialog.cpp index 54e4009e4..7bb2a5937 100644 --- a/retroshare-gui/src/gui/TransfersDialog.cpp +++ b/retroshare-gui/src/gui/TransfersDialog.cpp @@ -42,6 +42,7 @@ #define IMAGE_INFO ":/images/fileinfo.png" #define IMAGE_CANCEL ":/images/delete.png" #define IMAGE_CLEARCOMPLETED ":/images/deleteall.png" +#define IMAGE_PLAY ":/images/start.png" /** Constructor */ TransfersDialog::TransfersDialog(QWidget *parent) @@ -141,8 +142,35 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point ) QMenu contextMnu( this ); QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier ); -// showdowninfoAct = new QAction(QIcon(IMAGE_INFO), tr( "Details..." ), this ); -// connect( showdowninfoAct , SIGNAL( triggered() ), this, SLOT( showDownInfoWindow() ) ); + //showdowninfoAct = new QAction(QIcon(IMAGE_INFO), tr( "Details..." ), this ); + //connect( showdowninfoAct , SIGNAL( triggered() ), this, SLOT( showDownInfoWindow() ) ); + + /* check which item is selected + * - if it is completed - play should appear in menu + */ + std::cerr << "TransfersDialog::downloadListCostumPopupMenu()" << std::endl; + + bool addPlayOption = false; + for(int i = 0; i <= DLListModel->rowCount(); i++) { + std::cerr << "Row Status :" << getStatus(i, DLListModel).toStdString() << ":" << std::endl; + if(selection->isRowSelected(i, QModelIndex())) { + std::cerr << "Selected Row Status :" << getStatus(i, DLListModel).toStdString() << ":" << std::endl; + QString qstatus = getStatus(i, DLListModel); + std::string status = (qstatus.trimmed()).toStdString(); + if (status == "Complete") + { + std::cerr << "Add Play Option" << std::endl; + addPlayOption = true; + } + } + } + + QAction *playAct = NULL; + if (addPlayOption) + { + playAct = new QAction(QIcon(IMAGE_PLAY), tr( "Play" ), this ); + connect( playAct , SIGNAL( triggered() ), this, SLOT( playSelectedTransfer() ) ); + } cancelAct = new QAction(QIcon(IMAGE_CANCEL), tr( "Cancel" ), this ); connect( cancelAct , SIGNAL( triggered() ), this, SLOT( cancel() ) ); @@ -151,6 +179,12 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point ) connect( clearcompletedAct , SIGNAL( triggered() ), this, SLOT( clearcompleted() ) ); contextMnu.clear(); + if (addPlayOption) + { + contextMnu.addAction(playAct); + } + contextMnu.addSeparator(); + contextMnu.addAction( cancelAct); // contextMnu.addSeparator(); // contextMnu.addAction( showdowninfoAct); @@ -159,6 +193,39 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point ) contextMnu.exec( mevent->globalPos() ); } +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 */ + + /* create the List of Files */ + QStringList playList; + for(int i = 0; i <= DLListModel->rowCount(); i++) { + if(selection->isRowSelected(i, QModelIndex())) { + QString qstatus = getStatus(i, DLListModel); + std::string status = (qstatus.trimmed()).toStdString(); + if (status == "Complete") + { + QString qname = getFileName(i, DLListModel); + QString fullpath = QString::fromStdString(incomingdir); + fullpath += "/"; + fullpath += qname.trimmed(); + + playList.push_back(fullpath); + + std::cerr << "PlayFile:" << fullpath.toStdString() << std::endl; + + } + } + } + playFiles(playList); +} + + /** Shows Downloads Informations */ void TransfersDialog::showDownInfoWindow() { @@ -282,6 +349,17 @@ void TransfersDialog::insertTransfers() qlonglong fileSize, completed, remaining; double progress, dlspeed; + + /* get current selection */ + std::list selectedIds; + + for(int i = 0; i <= DLListModel->rowCount(); i++) { + if(selection->isRowSelected(i, QModelIndex())) { + std::string id = getID(i, DLListModel).toStdString(); + selectedIds.push_back(id); + } + } + //remove all Items for(int i = DLListModel->rowCount(); i >= 0; i--) { @@ -300,6 +378,9 @@ void TransfersDialog::insertTransfers() std::list::const_iterator it; const std::list &transfers = rsiface->getTransferList(); + uint32_t dlCount = 0; + uint32_t ulCount = 0; + for(it = transfers.begin(); it != transfers.end(); it++) { @@ -316,21 +397,28 @@ void TransfersDialog::insertTransfers() switch(it->downloadStatus) { - /* XXX HAND CODED! */ + + /******** 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: /* Downloading */ - if (it->tfRate > 0.01) - { - status = "Downloading"; - } - else - { - status = "Waiting for Peer"; - } + case 1: /* OKAY */ + status = "Okay"; break; - case 2: /* COMPLETE */ + case 2: /* WAITING */ + status = "Waiting"; + break; + case 3: /* DOWNLOADING */ + status = "Downloading"; + break; + case 4: /* COMPLETE */ default: status = "Complete"; break; @@ -347,11 +435,21 @@ void TransfersDialog::insertTransfers() { 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 { addUploadItem(symbol, name, coreId, fileSize, progress, dlspeed, sources, status, completed, remaining); + ulCount++; } } diff --git a/retroshare-gui/src/gui/TransfersDialog.h b/retroshare-gui/src/gui/TransfersDialog.h index a1718f430..225a2a275 100644 --- a/retroshare-gui/src/gui/TransfersDialog.h +++ b/retroshare-gui/src/gui/TransfersDialog.h @@ -61,7 +61,10 @@ private slots: void cancel(); /** removes finished Downloads**/ void clearcompleted(); - + void playSelectedTransfer(); + +signals: + void playFiles(QStringList files); private: QStandardItemModel *DLListModel; diff --git a/retroshare-gui/src/rsiface/RemoteDirModel.cpp b/retroshare-gui/src/rsiface/RemoteDirModel.cpp index 02e71b4b2..d17dedb3e 100644 --- a/retroshare-gui/src/rsiface/RemoteDirModel.cpp +++ b/retroshare-gui/src/rsiface/RemoteDirModel.cpp @@ -692,3 +692,53 @@ void RemoteDirModel::openSelected(QModelIndexList list) recommendSelected(list); } + +void RemoteDirModel::getFilePaths(QModelIndexList list, std::list &fullpaths) +{ + std::cerr << "RemoteDirModel::getFilePaths()" << std::endl; + if (RemoteMode) + { + std::cerr << "No File Paths for remote files" << std::endl; + return; + } + /* translate */ + QModelIndexList::iterator it; + for(it = list.begin(); it != list.end(); it++) + { + void *ref = it -> internalPointer(); + + DirDetails details; + uint32_t flags = DIR_FLAGS_DETAILS; + flags |= DIR_FLAGS_LOCAL; + + if (!rsicontrol->RequestDirDetails(ref, details, flags)) + { + std::cerr << "getFilePaths() Bad Request" << std::endl; + continue; + } + + if (details.type != DIR_TYPE_FILE) + { + std::cerr << "getFilePaths() Not File" << std::endl; + continue; /* not file! */ + } + + std::cerr << "::::::::::::File Details:::: " << std::endl; + std::cerr << "Name: " << details.name << std::endl; + std::cerr << "Hash: " << details.hash << std::endl; + std::cerr << "Size: " << details.count << std::endl; + std::cerr << "Path: " << details.path << std::endl; + + std::string filepath = details.path + "/"; + filepath += details.name; + + std::cerr << "Constructed FilePath: " << filepath << std::endl; + if (fullpaths.end() == std::find(fullpaths.begin(), fullpaths.end(), filepath)) + { + fullpaths.push_back(filepath); + } + } + std::cerr << "::::::::::::Done getFilePaths" << std::endl; +} + + diff --git a/retroshare-gui/src/rsiface/RemoteDirModel.h b/retroshare-gui/src/rsiface/RemoteDirModel.h index 42a7a124f..af5a08687 100644 --- a/retroshare-gui/src/rsiface/RemoteDirModel.h +++ b/retroshare-gui/src/rsiface/RemoteDirModel.h @@ -3,6 +3,8 @@ #include #include +#include +#include class RemoteDirModel : public QAbstractItemModel { @@ -40,6 +42,8 @@ class RemoteDirModel : public QAbstractItemModel void recommendSelectedOnly(QModelIndexList list); void openSelected(QModelIndexList list); + void getFilePaths(QModelIndexList list, std::list &fullpaths); + public slots: void collapsed ( const QModelIndex & index ) { update(index); } diff --git a/retroshare-gui/src/rsiface/rsiface.h b/retroshare-gui/src/rsiface/rsiface.h index 10d0b2aa3..36573d6b6 100644 --- a/retroshare-gui/src/rsiface/rsiface.h +++ b/retroshare-gui/src/rsiface/rsiface.h @@ -193,6 +193,10 @@ virtual int StartupRetroShare(RsInit *config) = 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 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; diff --git a/retroshare-gui/src/rsiface/rsnotify.h b/retroshare-gui/src/rsiface/rsnotify.h index 830c71b3f..d03d1de1b 100644 --- a/retroshare-gui/src/rsiface/rsnotify.h +++ b/retroshare-gui/src/rsiface/rsnotify.h @@ -65,11 +65,6 @@ virtual bool GetPopupMessageList(std::map &list) = 0; virtual bool SetSysMessageMode(uint32_t sysid, uint32_t mode) = 0; virtual bool SetPopupMessageMode(uint32_t ptype, uint32_t mode) = 0; - /* Input from libretroshare */ -virtual bool AddPopupMessage(uint32_t ptype, std::string name, std::string msg) = 0; -virtual bool AddSysMessage(uint32_t sysid, uint32_t type, - std::string title, std::string msg) = 0; - };