mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-12 07:59:29 -05:00
Various Gui improvements:
* Added fallback to only <id> 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
This commit is contained in:
parent
29a74b9898
commit
e07783ac2b
@ -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()));
|
||||
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -102,6 +102,8 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
|
||||
setWindowTitle(tr("RetroShare %1").arg(retroshareVersion()));
|
||||
|
||||
mSMPlayer = NULL;
|
||||
|
||||
/* Hide Console frame */
|
||||
//showConsoleFrame(false);
|
||||
//connect(ui.btnToggleConsole, SIGNAL(toggled(bool)), this, SLOT(showConsoleFrame(bool)));
|
||||
@ -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)));
|
||||
@ -645,15 +649,21 @@ 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()));*/
|
||||
if (mSMPlayer == 0)
|
||||
{
|
||||
mSMPlayer = new SMPlayer(QString::null, this);
|
||||
}
|
||||
smplayer->gui()->show();
|
||||
mSMPlayer->gui()->show();
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::playFiles(QStringList files)
|
||||
{
|
||||
showsmplayer();
|
||||
mSMPlayer->gui()->openFiles(files);
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::showabout()
|
||||
{
|
||||
static HelpDialog *helpdlg = new HelpDialog(this);
|
||||
|
@ -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:
|
||||
|
||||
|
@ -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 );
|
||||
|
@ -39,9 +39,12 @@
|
||||
#include <QMouseEvent>
|
||||
#include <QPixmap>
|
||||
#include <QHeaderView>
|
||||
#include <QTimer>
|
||||
|
||||
/* 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)
|
||||
@ -50,6 +53,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 ) ) );
|
||||
|
||||
connect( ui.remoteDirTreeView, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( shareddirtreeviewCostumPopupMenu( 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 )
|
||||
{
|
||||
|
||||
@ -173,6 +206,34 @@ void SharedFilesDialog::recommendfile()
|
||||
}
|
||||
|
||||
|
||||
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<std::string> paths;
|
||||
localModel -> getFilePaths(qism->selectedIndexes(), paths);
|
||||
|
||||
std::list<std::string>::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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void SharedFilesDialog::recommendFileSetOnly()
|
||||
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -5,8 +5,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>467</width>
|
||||
<height>309</height>
|
||||
<width>445</width>
|
||||
<height>401</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
@ -499,18 +499,6 @@
|
||||
<enum>Qt::NoContextMenu</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing" >
|
||||
<number>1</number>
|
||||
</property>
|
||||
@ -518,59 +506,10 @@
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="1" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
@ -612,9 +551,39 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>271</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="checkButton" >
|
||||
<property name="text" >
|
||||
<string>check files</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="hashLabel" >
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap" >
|
||||
<pixmap resource="images.qrc" >:/qss/black/checkBox_selected.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
|
@ -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)
|
||||
@ -144,6 +145,33 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
|
||||
//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<std::string> 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<FileTransferInfo>::const_iterator it;
|
||||
const std::list<FileTransferInfo> &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++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,10 @@ private slots:
|
||||
void cancel();
|
||||
/** removes finished Downloads**/
|
||||
void clearcompleted();
|
||||
void playSelectedTransfer();
|
||||
|
||||
signals:
|
||||
void playFiles(QStringList files);
|
||||
|
||||
private:
|
||||
QStandardItemModel *DLListModel;
|
||||
|
@ -692,3 +692,53 @@ void RemoteDirModel::openSelected(QModelIndexList list)
|
||||
recommendSelected(list);
|
||||
}
|
||||
|
||||
|
||||
void RemoteDirModel::getFilePaths(QModelIndexList list, std::list<std::string> &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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <string>
|
||||
|
||||
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<std::string> &fullpaths);
|
||||
|
||||
public slots:
|
||||
|
||||
void collapsed ( const QModelIndex & index ) { update(index); }
|
||||
|
@ -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<std::string> keywords, std::list<FileDetail> &results) = 0;
|
||||
|
@ -65,11 +65,6 @@ virtual bool GetPopupMessageList(std::map<uint32_t, std::string> &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;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user