diff --git a/retroshare-gui/src/gui/DetailsDialog.cpp b/retroshare-gui/src/gui/DetailsDialog.cpp index 4a01c7d48..2abcc01c3 100644 --- a/retroshare-gui/src/gui/DetailsDialog.cpp +++ b/retroshare-gui/src/gui/DetailsDialog.cpp @@ -36,6 +36,8 @@ #include #include "util/misc.h" +#include +#include /** Default constructor */ DetailsDialog::DetailsDialog(QWidget *parent, Qt::WFlags flags) @@ -60,6 +62,8 @@ DetailsDialog::DetailsDialog(QWidget *parent, Qt::WFlags flags) _coheader->resizeSection ( 0, 100 ); _coheader->resizeSection ( 1, 240 ); _coheader->resizeSection ( 2, 100 ); + + updateDisplay(); } @@ -85,6 +89,7 @@ void DetailsDialog::on_cancel_dButton_clicked() void DetailsDialog::show() { + ui.tabWidget->setCurrentIndex(0); if (!this->isVisible()) { QDialog::show(); } else { @@ -180,3 +185,34 @@ void DetailsDialog::setLink(const QString & link) { ui.Linktext->setText(link); } + +void DetailsDialog::showEvent(QShowEvent *event) +{ + updateDisplay(); +} + +void DetailsDialog::updateDisplay() +{ + + bool ok=true ; + FileInfo nfo ; + if(!rsFiles->FileDetails(_file_hash, RS_FILE_HINTS_DOWNLOAD, nfo)) + ok = false ; + FileChunksInfo info ; + if(!rsFiles->FileDownloadChunksDetails(_file_hash, info)) + ok = false ; + + if(ok) + { + uint32_t blockSize = info.chunk_size ; + + ui.chunksizelabel->setText(misc::friendlyUnit(blockSize)); + ui.numberofchunkslabel->setText(QString::number(info.chunks.size())); + + } + + +} + + + \ No newline at end of file diff --git a/retroshare-gui/src/gui/DetailsDialog.h b/retroshare-gui/src/gui/DetailsDialog.h index 1d9e5d932..21450eac2 100644 --- a/retroshare-gui/src/gui/DetailsDialog.h +++ b/retroshare-gui/src/gui/DetailsDialog.h @@ -29,6 +29,7 @@ #include "ui_DetailsDialog.h" +class FileChunksInfo ; class DetailsDialog : public QDialog { @@ -39,7 +40,10 @@ public: DetailsDialog(QWidget *parent = 0, Qt::WFlags flags = 0); /** Default destructor */ ~DetailsDialog(); + + void updateDisplay() ; + void setFileHash(const std::string& hash) { _file_hash = hash ; } public slots: /** Overloaded QWidget.show */ @@ -56,10 +60,13 @@ public slots: void setCompleted(const qulonglong & completed); void setRemaining(const qulonglong & remaining) ; void setType(const QString & type); + protected: void closeEvent (QCloseEvent * event); + virtual void showEvent(QShowEvent * event); + private slots: void on_ok_dButton_clicked(); void on_cancel_dButton_clicked(); @@ -68,6 +75,7 @@ private: class QStandardItemModel *CommentsModel; + std::string _file_hash ; /** Qt Designer generated object */ diff --git a/retroshare-gui/src/gui/DetailsDialog.ui b/retroshare-gui/src/gui/DetailsDialog.ui index 086e9cc99..ab7c0ae58 100644 --- a/retroshare-gui/src/gui/DetailsDialog.ui +++ b/retroshare-gui/src/gui/DetailsDialog.ui @@ -201,13 +201,6 @@ - - - - Remaining: - - - @@ -229,18 +222,7 @@ - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Remaining Label</span></p></body></html> - - - - + Qt::Horizontal @@ -253,6 +235,58 @@ p, li { white-space: pre-wrap; } + + + + Chunks Label + + + + + + + Chunk size: + + + + + + + Number of Chunks + + + Chunks Number Label + + + + + + + Number of Chunks + + + Chunks: + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Remaining Label</span></p></body></html> + + + + + + + Remaining: + + + diff --git a/retroshare-gui/src/gui/TransfersDialog.cpp b/retroshare-gui/src/gui/TransfersDialog.cpp index 4c7864e70..923433410 100644 --- a/retroshare-gui/src/gui/TransfersDialog.cpp +++ b/retroshare-gui/src/gui/TransfersDialog.cpp @@ -384,16 +384,18 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point ) contextMnu.addAction( cancelAct); contextMnu.addSeparator(); } -#ifndef RS_RELEASE_VERSION + if(single) { +#ifndef RS_RELEASE_VERSION contextMnu.addAction( openfileAct); contextMnu.addAction( previewfileAct); - contextMnu.addAction( openfolderAct); +#endif + contextMnu.addAction( openfolderAct); contextMnu.addAction( detailsfileAct); contextMnu.addSeparator(); } -#endif + contextMnu.addAction( clearcompletedAct); contextMnu.addSeparator(); #ifndef RS_RELEASE_VERSION @@ -1156,6 +1158,8 @@ void TransfersDialog::showDetailsDialog() QModelIndexList lst = ui.downloadList->selectionModel ()->selectedIndexes (); RetroShareLinkAnalyzer analyzer; + + std::string file_hash ; for (int i = 0; i < lst.count (); i++) { @@ -1174,6 +1178,17 @@ void TransfersDialog::showDetailsDialog() qulonglong fcompleted = ind.model ()->data (ind.model ()->index (ind.row (), COMPLETED)).toULongLong() ; qulonglong fremaining = ind.model ()->data (ind.model ()->index (ind.row (), REMAINING)).toULongLong() ; + 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 ; + } + + detailsdlg->setFileHash(file_hash); + // Set Details.. Window Title detailsdlg->setWindowTitle(tr("Details:") + fname);