mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-19 12:54:24 -05:00
Fixed to get work properly Play and OpenFile when File Transfer is complete, Play action is only visible when its a media file.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2377 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
3ff7635171
commit
76e2f5c9c4
@ -230,26 +230,40 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
|
|||||||
*/
|
*/
|
||||||
std::cerr << "TransfersDialog::downloadListCostumPopupMenu()" << std::endl;
|
std::cerr << "TransfersDialog::downloadListCostumPopupMenu()" << std::endl;
|
||||||
|
|
||||||
bool addPlayOption = false;
|
FileInfo info;
|
||||||
|
|
||||||
for(int i = 0; i <= DLListModel->rowCount(); i++) {
|
for (it = items.begin(); it != items.end(); it ++) {
|
||||||
std::cerr << "Row Status :" << getStatus(i, DLListModel).toStdString() << ":" << std::endl;
|
if (!rsFiles->FileDetails((*it)->data(Qt::DisplayRole).toString().toStdString(), RS_FILE_HINTS_DOWNLOAD, info)) continue;
|
||||||
if(selection->isRowSelected(i, QModelIndex())) {
|
break;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool addPlayOption = false;
|
||||||
|
bool addOpenFileOption = false;
|
||||||
|
|
||||||
|
if (info.downloadStatus == FT_STATE_COMPLETE)
|
||||||
|
{
|
||||||
|
std::cerr << "Add Play Option" << std::endl;
|
||||||
|
|
||||||
|
addOpenFileOption = true;
|
||||||
|
|
||||||
|
size_t pos = info.fname.find_last_of('.');
|
||||||
|
if (pos == -1) return; /* can't identify type of file */
|
||||||
|
|
||||||
|
/* check if the file is a media file */
|
||||||
|
if (misc::isPreviewable(info.fname.substr(pos + 1).c_str()))
|
||||||
|
{
|
||||||
|
addPlayOption = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QAction *playAct = NULL;
|
QAction *playAct = NULL;
|
||||||
if (addPlayOption)
|
if (addPlayOption)
|
||||||
{
|
{
|
||||||
playAct = new QAction(QIcon(IMAGE_PLAY), tr( "Play" ), this );
|
playAct = new QAction(QIcon(IMAGE_PLAY), tr( "Play" ), this );
|
||||||
connect( playAct , SIGNAL( triggered() ), this, SLOT( playSelectedTransfer() ) );
|
connect( playAct , SIGNAL( triggered() ), this, SLOT( openTransfer() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
QAction *detailsAct = NULL;
|
QAction *detailsAct = NULL;
|
||||||
@ -262,8 +276,8 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
|
|||||||
cancelAct = new QAction(QIcon(IMAGE_CANCEL), tr( "Cancel" ), this );
|
cancelAct = new QAction(QIcon(IMAGE_CANCEL), tr( "Cancel" ), this );
|
||||||
connect( cancelAct , SIGNAL( triggered() ), this, SLOT( cancel() ) );
|
connect( cancelAct , SIGNAL( triggered() ), this, SLOT( cancel() ) );
|
||||||
|
|
||||||
openfolderAct = new QAction(QIcon(IMAGE_OPENFOLDER), tr("Open Folder"), this);
|
openfolderAct = new QAction(QIcon(IMAGE_OPENFOLDER), tr("Open Folder"), this);
|
||||||
connect(openfolderAct, SIGNAL(triggered()), this, SLOT(openFolderTransfer()));
|
connect(openfolderAct, SIGNAL(triggered()), this, SLOT(openFolderTransfer()));
|
||||||
|
|
||||||
openfileAct = new QAction(QIcon(IMAGE_OPENFILE), tr("Open File"), this);
|
openfileAct = new QAction(QIcon(IMAGE_OPENFILE), tr("Open File"), this);
|
||||||
connect(openfileAct, SIGNAL(triggered()), this, SLOT(openTransfer()));
|
connect(openfileAct, SIGNAL(triggered()), this, SLOT(openTransfer()));
|
||||||
@ -377,8 +391,10 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
|
|||||||
|
|
||||||
if(single)
|
if(single)
|
||||||
{
|
{
|
||||||
#ifndef RS_RELEASE_VERSION
|
if (addOpenFileOption)
|
||||||
contextMnu.addAction( openfileAct);
|
contextMnu.addAction( openfileAct);
|
||||||
|
|
||||||
|
#ifndef RS_RELEASE_VERSION
|
||||||
contextMnu.addAction( previewfileAct);
|
contextMnu.addAction( previewfileAct);
|
||||||
#endif
|
#endif
|
||||||
contextMnu.addAction( openfolderAct);
|
contextMnu.addAction( openfolderAct);
|
||||||
@ -400,36 +416,6 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
|
|||||||
contextMnu.exec( mevent->globalPos() );
|
contextMnu.exec( mevent->globalPos() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransfersDialog::playSelectedTransfer()
|
|
||||||
{
|
|
||||||
std::cerr << "TransfersDialog::playSelectedTransfer()" << std::endl;
|
|
||||||
|
|
||||||
/* get the shared directories */
|
|
||||||
std::string incomingdir = rsFiles->getDownloadDirectory();
|
|
||||||
|
|
||||||
/* 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
TransfersDialog::~TransfersDialog()
|
TransfersDialog::~TransfersDialog()
|
||||||
{
|
{
|
||||||
;
|
;
|
||||||
@ -1045,18 +1031,6 @@ void TransfersDialog::showDetailsDialog()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// display properties of selected items
|
|
||||||
/*void DownloadingTorrents::propertiesSelection(){
|
|
||||||
QModelIndexList selectedIndexes = downloadList->selectionModel()->selectedIndexes();
|
|
||||||
foreach(const QModelIndex &index, selectedIndexes){
|
|
||||||
if(index.column() == NAME){
|
|
||||||
showProperties(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void TransfersDialog::pasteLink()
|
void TransfersDialog::pasteLink()
|
||||||
{
|
{
|
||||||
QClipboard *clipboard = QApplication::clipboard();
|
QClipboard *clipboard = QApplication::clipboard();
|
||||||
|
@ -70,7 +70,6 @@ private slots:
|
|||||||
void cancel();
|
void cancel();
|
||||||
/** removes finished Downloads**/
|
/** removes finished Downloads**/
|
||||||
void clearcompleted();
|
void clearcompleted();
|
||||||
void playSelectedTransfer();
|
|
||||||
|
|
||||||
void copyLink();
|
void copyLink();
|
||||||
void pasteLink();
|
void pasteLink();
|
||||||
|
Loading…
Reference in New Issue
Block a user