diff --git a/retroshare-gui/src/gui/DetailsDialog.cpp b/retroshare-gui/src/gui/DetailsDialog.cpp index 7df7ee756..bc0d97ae9 100644 --- a/retroshare-gui/src/gui/DetailsDialog.cpp +++ b/retroshare-gui/src/gui/DetailsDialog.cpp @@ -20,11 +20,15 @@ ****************************************************************/ #include +#include #include "DetailsDialog.h" #include "TransfersDialog.h" +#include "retroshare/rsfiles.h" #include "util/misc.h" +#include "FileTransferInfoWidget.h" +#include "RetroShareLink.h" /** Default constructor */ DetailsDialog::DetailsDialog(QWidget *parent, Qt::WFlags flags) @@ -33,42 +37,52 @@ DetailsDialog::DetailsDialog(QWidget *parent, Qt::WFlags flags) /* Invoke Qt Designer generated QObject setup routine */ ui.setupUi(this); - - setAttribute ( Qt::WA_DeleteOnClose, true ); - CommentsModel = new QStandardItemModel(0, 3); - CommentsModel->setHeaderData(0, Qt::Horizontal, tr("Rating")); - CommentsModel->setHeaderData(1, Qt::Horizontal, tr("Comments")); - CommentsModel->setHeaderData(2, Qt::Horizontal, tr("File Name")); - - ui.commentsTreeView->setModel(CommentsModel); - ui.commentsTreeView->setSortingEnabled(true); - ui.commentsTreeView->setRootIsDecorated(false); - - /* Set header resize modes and initial section sizes */ - QHeaderView * _coheader = ui.commentsTreeView->header(); - _coheader->setResizeMode ( 0, QHeaderView::Custom); - _coheader->resizeSection ( 0, 100 ); - _coheader->resizeSection ( 1, 240 ); - _coheader->resizeSection ( 2, 100 ); - + setAttribute ( Qt::WA_DeleteOnClose, true ); + + CommentsModel = new QStandardItemModel(0, 3); + CommentsModel->setHeaderData(0, Qt::Horizontal, tr("Rating")); + CommentsModel->setHeaderData(1, Qt::Horizontal, tr("Comments")); + CommentsModel->setHeaderData(2, Qt::Horizontal, tr("File Name")); + + //ui.commentsTreeView->setModel(CommentsModel); + //ui.commentsTreeView->setSortingEnabled(true); + //ui.commentsTreeView->setRootIsDecorated(false); + + /* Set header resize modes and initial section sizes */ + //QHeaderView * _coheader = ui.commentsTreeView->header(); + //_coheader->setResizeMode ( 0, QHeaderView::Custom); + //_coheader->resizeSection ( 0, 100 ); + //_coheader->resizeSection ( 1, 240 ); + //_coheader->resizeSection ( 2, 100 ); + + FileTransferInfoWidget *ftiw = new FileTransferInfoWidget(); + ui.fileTransferInfoWidget->setWidget(ftiw); + ui.fileTransferInfoWidget->setWidgetResizable(true); + ui.fileTransferInfoWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + ui.fileTransferInfoWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + ui.fileTransferInfoWidget->viewport()->setBackgroundRole(QPalette::NoRole); + ui.fileTransferInfoWidget->setFrameStyle(QFrame::NoFrame); + ui.fileTransferInfoWidget->setFocusPolicy(Qt::NoFocus); + + setAttribute(Qt::WA_DeleteOnClose,false) ; + + connect(ui.copylinkdetailsButton,SIGNAL(clicked()),this,SLOT(copyLink())) ; } -/** Destructor. */ -DetailsDialog::~DetailsDialog() +void DetailsDialog::copyLink() { - TransfersDialog::detailsdlg = NULL; + QApplication::clipboard()->setText( ui.Linktext->toPlainText() ); } - void DetailsDialog::on_ok_dButton_clicked() { - QDialog::close(); + QDialog::hide(); } void DetailsDialog::on_cancel_dButton_clicked() { //reject(); - QDialog::close(); + QDialog::hide(); } @@ -85,101 +99,17 @@ DetailsDialog::show() } } -void DetailsDialog::closeEvent (QCloseEvent * event) +void DetailsDialog::setFileHash(const std::string & hash) { - QWidget::closeEvent(event); + dynamic_cast(ui.fileTransferInfoWidget->widget())->setFileHash(hash) ; + + FileInfo nfo ; + if(!rsFiles->FileDetails(hash, RS_FILE_HINTS_DOWNLOAD, nfo)) + return ; + + RetroShareLink link ; + link.createFile(QString::fromStdString(nfo.fname),nfo.size,QString::fromStdString(nfo.hash)) ; + + ui.Linktext->setText(link.toString()) ; } -void DetailsDialog::setFileName(const QString & filename) -{ - int c; - QModelIndex index; - - c = CommentsModel->rowCount(); - CommentsModel->removeRows(0,c); - - c = CommentsModel->rowCount(); - CommentsModel->insertRow(c); - - index = CommentsModel->index(c, 0); - CommentsModel->setData(index, tr("Not Rated")); - - index = CommentsModel->index(c, 1); - CommentsModel->setData(index, tr("No Comments")); - - index = CommentsModel->index(c, 2); - CommentsModel->setData(index, filename); - - ui.name_label_2->setText(filename); - -} - -void DetailsDialog::setHash(const QString & hash) -{ - ui.hash_label_2->setText(hash); -} - -void DetailsDialog::setSize(const qulonglong & size) -{ - ui.size_label_2->setText(misc::friendlyUnit(size) + " " + "(" + QString::number(size) + " " + "Bytes" + ")"); -} - -void DetailsDialog::setStatus(const QString & status) -{ - ui.status_label_2->setText(status); -} - -void DetailsDialog::setPriority(const QString & priority) -{ - ui.priority_label_2->setText(priority); -} - -void DetailsDialog::setType(const QString & type) -{ - ui.type_label_2->setText(type); -} - -void DetailsDialog::setSources(const QString & sources) -{ - ui.sources_line->setText(sources); -} - -void DetailsDialog::setDatarate(const double & datarate) -{ - QString temp; - temp.clear(); - temp.sprintf("%.2f", datarate/1024.); - temp += " KB/s"; - - ui.datarate_line->setText(temp); -} - -void DetailsDialog::setCompleted(const QString & completed) -{ - ui.completed_line->setText(completed); -} - -void DetailsDialog::setRemaining(const QString & remaining) -{ - ui.remaining_line->setText(remaining); -} - -void DetailsDialog::setDownloadtime(const QString & downloadtime) -{ - ui.downloadtime_line->setText(downloadtime); -} - -void DetailsDialog::setLink(const QString & link) -{ - ui.Linktext->setText(link); -} - -void DetailsDialog::setChunkSize(uint32_t chunksize) -{ - ui.chunksizelabel->setText(misc::friendlyUnit(chunksize)); -} - -void DetailsDialog::setNumberOfChunks(size_t numberofchunks) -{ - ui.numberofchunkslabel->setText(QString::number(numberofchunks)); -} diff --git a/retroshare-gui/src/gui/DetailsDialog.h b/retroshare-gui/src/gui/DetailsDialog.h index b22a90e45..dae2d2d52 100644 --- a/retroshare-gui/src/gui/DetailsDialog.h +++ b/retroshare-gui/src/gui/DetailsDialog.h @@ -35,32 +35,14 @@ public: /** Default constructor */ DetailsDialog(QWidget *parent = 0, Qt::WFlags flags = 0); /** Default destructor */ - ~DetailsDialog(); + ~DetailsDialog() {} - void setFileHash(const std::string& hash) { _file_hash = hash ; } + void setFileHash(const std::string& hash) ; public slots: /** Overloaded QWidget.show */ void show(); - - void setFileName(const QString & filename); - void setHash(const QString & hash); - void setLink(const QString & link); - void setSize(const qulonglong & size); - void setStatus(const QString & status); - void setPriority(const QString & priority); - void setSources(const QString & sources); - void setDatarate(const double & datarate); - void setCompleted(const QString & completed); - void setRemaining(const QString & remaining) ; - void setDownloadtime(const QString & downloadtime); - void setType(const QString & type); - void setChunkSize(const uint32_t chunksize); - void setNumberOfChunks(const size_t numberofchunks); - - -protected: - void closeEvent (QCloseEvent * event); + void copyLink() ; private slots: void on_ok_dButton_clicked(); diff --git a/retroshare-gui/src/gui/DetailsDialog.ui b/retroshare-gui/src/gui/DetailsDialog.ui index 9cbc14951..e6abcb7cf 100644 --- a/retroshare-gui/src/gui/DetailsDialog.ui +++ b/retroshare-gui/src/gui/DetailsDialog.ui @@ -6,8 +6,8 @@ 0 0 - 525 - 477 + 787 + 644 @@ -21,348 +21,143 @@ - 0 + 1 - :/images/fileinfo.png:/images/fileinfo.png + :/images/blockdevice.png:/images/blockdevice.png General - - - - General - - - - - - - 16777215 - 16777215 - - - - Qt::LeftToRight - - - File Name: - - - - - - - Name Label - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - Qt::Horizontal - - - - 336 - 98 - - - - - - - - - 1677215 - 16777215 - - - - Qt::LeftToRight - - - Hash: - - - - - - - - 16777215 - 16777215 - - - - Qt::LeftToRight - - - Size: - - - - - - - Size Label - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - - 16777215 - 16777215 - - - - Qt::LeftToRight - - - Status: - - - - - - - Status Label - - - Qt::LinksAccessibleByMouse - - - - - - - Priority: - - - - - - - Priority Label - - - Qt::LinksAccessibleByMouse - - - - - - - Type Label - - - - - - - Type: - - - - - - - Hash Label - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - - - Transfer + + + 6 - - - - - Sources: - - - - - - - Datarate: - - - - - - - Completed: - - - - - - - Source Label - - - - - - - Datarate Label - - - - - - - Completed Label - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Chunks Label - - - - - - - Chunk size: - - - - - - - Number of Chunks - - - Chunks Number Label - - - - - - - Number of Chunks - - - Chunks: - - - - - - - Remaining Label - - - - - - - Remaining: - - - - - + + + + + + + + + :/images/graph-downloaded.png + + + + + + + Done + + + + + + + + + + + + + + :/images/graph-downloading.png + + + + + + + Active + + + + + + + + + + + + + + :/images/graph-notdownload.png + + + + + + + Outstanding + + + + + + + + + Qt::Horizontal + + + + 368 + 13 + + + + + + + + + + + + + :/images/graph-checking.png + + + + + + + Needs checking + + + + + + - - - - Date - - - - - - Download time: - - - - - - - Download Time Label - - - - - - - Qt::Horizontal - - - - 274 - 20 - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - :/images/filecomments.png:/images/filecomments.png - - - Comments - - - + + + QFrame::NoFrame + + + Qt::ScrollBarAlwaysOff + + + true + + + + + 0 + 0 + 747 + 505 + + + + @@ -374,35 +169,22 @@ - retroshare link(s) + retroshare link - + + + + + Copy link to clipboard + + + - - - - Qt::Horizontal - - - - 351 - 20 - - - - - - - - Copy - - - diff --git a/retroshare-gui/src/gui/FileTransferInfoWidget.cpp b/retroshare-gui/src/gui/FileTransferInfoWidget.cpp index 09a7e91aa..0937ffcb2 100644 --- a/retroshare-gui/src/gui/FileTransferInfoWidget.cpp +++ b/retroshare-gui/src/gui/FileTransferInfoWidget.cpp @@ -28,6 +28,7 @@ #include #include "util/misc.h" #include "FileTransferInfoWidget.h" +#include "RetroShareLink.h" // Variables to decide of display behaviour. Should be adapted to window size. // @@ -110,7 +111,7 @@ void FileTransferInfoWidget::paintEvent(QPaintEvent */*event*/) void FileTransferInfoWidget::draw(const FileInfo& nfo,const FileChunksInfo& info,QPainter *painter) { x=0; - y=0; + y=5; int blocks = info.chunks.size() ; uint64_t fileSize = info.file_size ; uint32_t blockSize = info.chunk_size ; @@ -240,10 +241,11 @@ void FileTransferInfoWidget::draw(const FileInfo& nfo,const FileChunksInfo& info // various info: // - painter->setPen(QColor::fromRgb(0,0,0)) ; y += text_height ; painter->drawText(0,y,tr("File info") + ":") ; y += block_sep ; + y += text_height ; painter->drawText(20,y,tr("File name") + ":") ; painter->drawText(tab_size,y,QString::fromStdString(nfo.fname)) ; + y += block_sep ; y += text_height ; painter->drawText(20,y,tr("File hash") + ":") ; painter->drawText(tab_size,y,QString::fromStdString(nfo.hash)) ; y += block_sep ; y += text_height ; painter->drawText(20,y,tr("File size") + ":") ; painter->drawText(tab_size,y,QString::number(info.file_size) + " " + tr("bytes") + " " + "(" + misc::friendlyUnit(info.file_size) + ")") ; diff --git a/retroshare-gui/src/gui/TransfersDialog.cpp b/retroshare-gui/src/gui/TransfersDialog.cpp index c30cc2fb9..e3f150c41 100644 --- a/retroshare-gui/src/gui/TransfersDialog.cpp +++ b/retroshare-gui/src/gui/TransfersDialog.cpp @@ -66,6 +66,7 @@ /* Images for context menu icons */ #define IMAGE_INFO ":/images/fileinfo.png" #define IMAGE_CANCEL ":/images/delete.png" +#define IMAGE_LIBRARY ":/images/library.png" #define IMAGE_CLEARCOMPLETED ":/images/deleteall.png" #define IMAGE_PLAY ":/images/player_play.png" #define IMAGE_COPYLINK ":/images/copyrslink.png" @@ -85,8 +86,6 @@ Q_DECLARE_METATYPE(FileProgressInfo) -DetailsDialog *TransfersDialog::detailsdlg = NULL; - class SortByNameItem : public QStandardItem { public: @@ -293,19 +292,19 @@ TransfersDialog::TransfersDialog(QWidget *parent) // set default column and sort order for upload ui.uploadsList->sortByColumn(UNAME, Qt::AscendingOrder); - FileTransferInfoWidget *ftiw = new FileTransferInfoWidget(); - ui.fileTransferInfoWidget->setWidget(ftiw); - ui.fileTransferInfoWidget->setWidgetResizable(true); - ui.fileTransferInfoWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - ui.fileTransferInfoWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); - ui.fileTransferInfoWidget->viewport()->setBackgroundRole(QPalette::NoRole); - ui.fileTransferInfoWidget->setFrameStyle(QFrame::NoFrame); - ui.fileTransferInfoWidget->setFocusPolicy(Qt::NoFocus); + // FileTransferInfoWidget *ftiw = new FileTransferInfoWidget(); + // ui.fileTransferInfoWidget->setWidget(ftiw); + // ui.fileTransferInfoWidget->setWidgetResizable(true); + // ui.fileTransferInfoWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + // ui.fileTransferInfoWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + // ui.fileTransferInfoWidget->viewport()->setBackgroundRole(QPalette::NoRole); + // ui.fileTransferInfoWidget->setFrameStyle(QFrame::NoFrame); + // ui.fileTransferInfoWidget->setFocusPolicy(Qt::NoFocus); QObject::connect(ui.downloadList->selectionModel(),SIGNAL(selectionChanged (const QItemSelection&, const QItemSelection&)),this,SLOT(showFileDetails())) ; - ui.tabWidget->insertTab(0,searchDialog = new SearchDialog(), QIcon(IMAGE_SEARCH), tr("Search")) ; - ui.tabWidget->insertTab(1,remoteSharedFiles = new RemoteSharedFilesDialog(), QIcon(IMAGE_SEARCH), tr("Friends files")) ; + ui.tabWidget->insertTab(2,searchDialog = new SearchDialog(), QIcon(IMAGE_SEARCH), tr("Search")) ; + ui.tabWidget->insertTab(3,remoteSharedFiles = new RemoteSharedFilesDialog(), QIcon(IMAGE_SEARCH), tr("Friends files")) ; ui.tabWidget->addTab(localSharedFiles = new LocalSharedFilesDialog(), QIcon(IMAGE_SEARCH), tr("Your files")) ; @@ -332,10 +331,14 @@ TransfersDialog::TransfersDialog(QWidget *parent) #endif - QObject::connect(ui._showCacheTransfers_CB,SIGNAL(toggled(bool)),this,SLOT(insertTransfers())) ; - QObject::connect(ui.openCollection, SIGNAL(clicked()), this, SLOT(openCollection())); + toggleShowCacheTransfersAct = new QAction(tr( "Show cache transfers" ), this ); + toggleShowCacheTransfersAct->setCheckable(true) ; + connect(toggleShowCacheTransfersAct,SIGNAL(triggered()),this,SLOT(toggleShowCacheTransfers())) ; - // Actions. Only need to be defined once. + openCollectionAct = new QAction(QIcon(IMAGE_LIBRARY), tr( "Download from collection file..." ), this ); + connect(openCollectionAct, SIGNAL(triggered()), this, SLOT(openCollection())); + + // Actions. Only need to be defined once. pauseAct = new QAction(QIcon(IMAGE_PAUSE), tr("Pause"), this); connect(pauseAct, SIGNAL(triggered()), this, SLOT(pauseFileTransfer())); @@ -410,6 +413,12 @@ UserNotify *TransfersDialog::getUserNotify(QObject *parent) return new TransferUserNotify(parent); } +void TransfersDialog::toggleShowCacheTransfers() +{ + _show_cache_transfers = !_show_cache_transfers ; + insertTransfers() ; +} + void TransfersDialog::processSettings(bool bLoad) { m_bProcessSettings = true; @@ -423,14 +432,14 @@ void TransfersDialog::processSettings(bool bLoad) // load settings // state of checks - ui._showCacheTransfers_CB->setChecked(Settings->value("showCacheTransfers", false).toBool()); + _show_cache_transfers = Settings->value("showCacheTransfers", false).toBool(); // state of the lists DLHeader->restoreState(Settings->value("downloadList").toByteArray()); ULHeader->restoreState(Settings->value("uploadList").toByteArray()); // state of splitter - ui.splitter->restoreState(Settings->value("Splitter").toByteArray()); +// ui.splitter->restoreState(Settings->value("Splitter").toByteArray()); // selected tab ui.tabWidget->setCurrentIndex(Settings->value("selectedTab").toInt()); @@ -438,14 +447,14 @@ void TransfersDialog::processSettings(bool bLoad) // save settings // state of checks - Settings->setValue("showCacheTransfers", ui._showCacheTransfers_CB->isChecked()); + Settings->setValue("showCacheTransfers", _show_cache_transfers); // state of the lists Settings->setValue("downloadList", DLHeader->saveState()); Settings->setValue("uploadList", ULHeader->saveState()); // state of splitter - Settings->setValue("Splitter", ui.splitter->saveState()); +// Settings->setValue("Splitter", ui.splitter->saveState()); // selected tab Settings->setValue("selectedTab", ui.tabWidget->currentIndex()); @@ -611,6 +620,12 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint /*point*/ ) contextMnu.addSeparator(); + contextMnu.addAction( toggleShowCacheTransfersAct ) ; + toggleShowCacheTransfersAct->setChecked(_show_cache_transfers) ; + contextMnu.addAction( openCollectionAct ) ; + + contextMnu.addSeparator(); + contextMnu.exec(QCursor::pos()); } @@ -913,8 +928,6 @@ void TransfersDialog::insertTransfers() std::list downHashes; rsFiles->FileDownloads(downHashes); - bool showCacheTransfers = ui._showCacheTransfers_CB->isChecked(); - /* get only once */ std::map versions; rsDisc->getDiscVersions(versions); @@ -950,7 +963,7 @@ void TransfersDialog::insertTransfers() continue; } - if ((fileInfo.transfer_info_flags & RS_FILE_REQ_CACHE) && !showCacheTransfers) { + if ((fileInfo.transfer_info_flags & RS_FILE_REQ_CACHE) && !_show_cache_transfers) { // if file transfer is a cache file index file, don't show it DLListModel->removeRow(row); rowCount = DLListModel->rowCount(); @@ -976,7 +989,7 @@ void TransfersDialog::insertTransfers() continue; } - if ((fileInfo.transfer_info_flags & RS_FILE_REQ_CACHE) && !showCacheTransfers) { + if ((fileInfo.transfer_info_flags & RS_FILE_REQ_CACHE) && !_show_cache_transfers) { //if file transfer is a cache file index file, don't show it continue; } @@ -1003,7 +1016,7 @@ void TransfersDialog::insertTransfers() if (!rsFiles->FileDetails(*it, RS_FILE_HINTS_UPLOAD, info)) continue; - if((info.transfer_info_flags & RS_FILE_REQ_CACHE) && showCacheTransfers) + if((info.transfer_info_flags & RS_FILE_REQ_CACHE) && _show_cache_transfers) continue ; std::list::iterator pit; @@ -1175,39 +1188,23 @@ void TransfersDialog::copyLink () RSLinkClipboard::copyLinks(links) ; } +DetailsDialog *TransfersDialog::detailsDialog() +{ + static DetailsDialog *detailsdlg = new DetailsDialog ; + + return detailsdlg ; +} + void TransfersDialog::showDetailsDialog() { - if (detailsdlg == NULL) { - // create window - detailsdlg = new DetailsDialog (); - } - updateDetailsDialog (); - detailsdlg->show(); + detailsDialog()->show(); } void TransfersDialog::updateDetailsDialog() { - if (detailsdlg == NULL) { - return; - } - std::string file_hash ; - QString fhash; - QString fsize; - QString fname; - QString fstatus; - QString fpriority; - QString fsources; - - qulonglong filesize = 0; - double fdatarate = 0; - qulonglong fcompleted = 0; - qulonglong fremaining = 0; - - qulonglong fdownloadtime = 0; - std::set rows; std::set::iterator it; getSelectedItems(NULL, &rows); @@ -1215,84 +1212,10 @@ void TransfersDialog::updateDetailsDialog() if (rows.size()) { int row = *rows.begin(); - fhash = getID(row, DLListModel); - fsize = getFileSize(row, DLListModel); - fname = getFileName(row, DLListModel); - fstatus = getStatus(row, DLListModel); - fpriority = getPriority(row, DLListModel); - fsources = getSources(row, DLListModel); - - filesize = getFileSize(row, DLListModel); - fdatarate = getSpeed(row, DLListModel); - fcompleted = getTransfered(row, DLListModel); - fremaining = getRemainingTime(row, DLListModel); - - fdownloadtime = getDownloadTime(row, DLListModel); - -// maybe show all links in retroshare link(s) Tab -// int nb_select = 0 ; -// -// for(int i = 0; i <= DLListModel->rowCount(); i++) -// if(selection->isRowSelected(i, QModelIndex())) -// { -// file_hash = getID(i, DLListModel).toStdString(); -// ++nb_select ; -// } - file_hash = getID(row, DLListModel).toStdString(); } - detailsdlg->setFileHash(file_hash); - - // Set Details.. Window Title - detailsdlg->setWindowTitle(tr("Details:") + fname); - - // General GroupBox - detailsdlg->setHash(fhash); - detailsdlg->setFileName(fname); - detailsdlg->setSize(filesize); - detailsdlg->setStatus(fstatus); - detailsdlg->setPriority(fpriority); - detailsdlg->setType(QFileInfo(fname).suffix()); - - // Transfer GroupBox - detailsdlg->setSources(fsources); - detailsdlg->setDatarate(fdatarate); - if (fname.isEmpty()) { - detailsdlg->setCompleted(misc::friendlyUnit(-1)); - detailsdlg->setRemaining(misc::friendlyUnit(-1)); - } else { - detailsdlg->setCompleted(misc::friendlyUnit(fcompleted)); - detailsdlg->setRemaining(misc::friendlyUnit(fremaining)); - } - - //Date GroupBox - if (fname.isEmpty()) { - detailsdlg->setDownloadtime(misc::userFriendlyDuration(-1)); - } else { - detailsdlg->setDownloadtime(misc::userFriendlyDuration(fdownloadtime)); - } - - // retroshare link(s) Tab - if (fname.isEmpty()) { - detailsdlg->setLink(""); - } else { - RetroShareLink link; - if (link.createFile(fname, filesize, fhash)) { - detailsdlg->setLink(link.toString()); - } else { - detailsdlg->setLink(""); - } - } - - FileChunksInfo info ; - if (fhash.isEmpty() == false && rsFiles->FileDownloadChunksDetails(fhash.toStdString(), info)) { - detailsdlg->setChunkSize(info.chunk_size); - detailsdlg->setNumberOfChunks(info.chunks.size()); - } else { - detailsdlg->setChunkSize(0); - detailsdlg->setNumberOfChunks(0); - } + detailsDialog()->setFileHash(file_hash); } void TransfersDialog::pasteLink() @@ -1598,15 +1521,11 @@ void TransfersDialog::showFileDetails() ++nb_select ; } if(nb_select != 1) - dynamic_cast(ui.fileTransferInfoWidget->widget())->setFileHash("") ; + detailsDialog()->setFileHash("") ; else - dynamic_cast(ui.fileTransferInfoWidget->widget())->setFileHash(file_hash) ; + detailsDialog()->setFileHash(file_hash) ; - std::cout << "calling update " << std::endl ; - dynamic_cast(ui.fileTransferInfoWidget->widget())->updateDisplay() ; - std::cout << "done" << std::endl ; - - updateDetailsDialog (); + updateDetailsDialog (); } double TransfersDialog::getProgress(int , QStandardItemModel *) diff --git a/retroshare-gui/src/gui/TransfersDialog.h b/retroshare-gui/src/gui/TransfersDialog.h index 3f493c641..432316791 100644 --- a/retroshare-gui/src/gui/TransfersDialog.h +++ b/retroshare-gui/src/gui/TransfersDialog.h @@ -55,7 +55,7 @@ public: // virtual void keyPressEvent(QKeyEvent *) ; virtual void updateDisplay() ; // derived from RsAutoUpdateWidget - static DetailsDialog *detailsdlg; + static DetailsDialog *detailsDialog() ; SearchDialog *searchDialog ; LocalSharedFilesDialog *localSharedFiles ; @@ -157,6 +157,8 @@ private: QAction *chunkRandomAct; QAction *chunkStreamingAct; QAction *detailsfileAct; + QAction *toggleShowCacheTransfersAct; + QAction *openCollectionAct; bool m_bProcessSettings; void processSettings(bool bLoad); @@ -174,6 +176,7 @@ private: /** Qt Designer generated object */ Ui::TransfersDialog ui; + bool _show_cache_transfers ; public slots: // these two functions add entries to the transfers dialog, and return the row id of the entry modified/added // @@ -183,6 +186,7 @@ public slots: int addUploadItem(const QString& symbol, const QString& name, const QString& coreID, qlonglong size, const FileProgressInfo& pinfo, double dlspeed, const QString& sources,const QString& source_id, const QString& status, qlonglong completed, qlonglong remaining); void showFileDetails() ; + void toggleShowCacheTransfers() ; double getProgress(int row, QStandardItemModel *model); double getSpeed(int row, QStandardItemModel *model); diff --git a/retroshare-gui/src/gui/TransfersDialog.ui b/retroshare-gui/src/gui/TransfersDialog.ui index e51962ff2..147cd6662 100644 --- a/retroshare-gui/src/gui/TransfersDialog.ui +++ b/retroshare-gui/src/gui/TransfersDialog.ui @@ -10,18 +10,31 @@ 353 - - - - - Qt::Vertical + + + + + + 75 + true + - - - + + 1 + + + + + :/images/down.png:/images/down.png + + + Downloads + + + 0 - + @@ -72,276 +85,37 @@ - - - - - 0 - 32 - + + + + + + :/images/up.png:/images/up.png + + + Uploads + + + + 0 + + + 0 + + + + + + 9 + - - - 16777215 - 32 - + + true - - QFrame::Box - - - QFrame::Sunken - - - - 2 - - - - - - - - :/images/down.png - - - - - - - - 10 - 75 - true - - - - Downloads - - - - - - - Qt::Horizontal - - - - 483 - 20 - - - - - - - - Qt::NoFocus - - - Open Collection - - - - - - - Qt::ClickFocus - - - Show cache transfers - - - - - - - - 75 - true - - - - 0 - - - - - :/images/up.png:/images/up.png - - - Uploads - - - - 0 - - - 0 - - - - - - 9 - - - - true - - - - - - - - - :/images/blockdevice.png:/images/blockdevice.png - - - Selected transfer - - - - 0 - - - 6 - - - - - QFrame::NoFrame - - - Qt::ScrollBarAlwaysOff - - - true - - - - - 0 - 0 - 100 - 30 - - - - - - - - - 6 - - - - - - - - - - :/images/graph-downloaded.png - - - - - - - Done - - - - - - - - - - - - - - :/images/graph-downloading.png - - - - - - - Active - - - - - - - - - - - - - - :/images/graph-notdownload.png - - - - - - - Outstanding - - - - - - - - - Qt::Horizontal - - - - 368 - 13 - - - - - - - - - - - - - :/images/graph-checking.png - - - - - - - Needs checking - - - - - - - - - -