mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-31 11:54:22 -04:00
Added Chunk size and Number of Chunks to DetailsDialog
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2131 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
ef21de908c
commit
656aa9db5d
4 changed files with 115 additions and 22 deletions
|
@ -36,6 +36,8 @@
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
|
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
|
#include <rsiface/rsfiles.h>
|
||||||
|
#include <rsiface/rstypes.h>
|
||||||
|
|
||||||
/** Default constructor */
|
/** Default constructor */
|
||||||
DetailsDialog::DetailsDialog(QWidget *parent, Qt::WFlags flags)
|
DetailsDialog::DetailsDialog(QWidget *parent, Qt::WFlags flags)
|
||||||
|
@ -60,6 +62,8 @@ DetailsDialog::DetailsDialog(QWidget *parent, Qt::WFlags flags)
|
||||||
_coheader->resizeSection ( 0, 100 );
|
_coheader->resizeSection ( 0, 100 );
|
||||||
_coheader->resizeSection ( 1, 240 );
|
_coheader->resizeSection ( 1, 240 );
|
||||||
_coheader->resizeSection ( 2, 100 );
|
_coheader->resizeSection ( 2, 100 );
|
||||||
|
|
||||||
|
updateDisplay();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -85,6 +89,7 @@ void DetailsDialog::on_cancel_dButton_clicked()
|
||||||
void
|
void
|
||||||
DetailsDialog::show()
|
DetailsDialog::show()
|
||||||
{
|
{
|
||||||
|
ui.tabWidget->setCurrentIndex(0);
|
||||||
if (!this->isVisible()) {
|
if (!this->isVisible()) {
|
||||||
QDialog::show();
|
QDialog::show();
|
||||||
} else {
|
} else {
|
||||||
|
@ -180,3 +185,34 @@ void DetailsDialog::setLink(const QString & link)
|
||||||
{
|
{
|
||||||
ui.Linktext->setText(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()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include "ui_DetailsDialog.h"
|
#include "ui_DetailsDialog.h"
|
||||||
|
|
||||||
|
class FileChunksInfo ;
|
||||||
|
|
||||||
class DetailsDialog : public QDialog
|
class DetailsDialog : public QDialog
|
||||||
{
|
{
|
||||||
|
@ -39,7 +40,10 @@ public:
|
||||||
DetailsDialog(QWidget *parent = 0, Qt::WFlags flags = 0);
|
DetailsDialog(QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||||
/** Default destructor */
|
/** Default destructor */
|
||||||
~DetailsDialog();
|
~DetailsDialog();
|
||||||
|
|
||||||
|
void updateDisplay() ;
|
||||||
|
|
||||||
|
void setFileHash(const std::string& hash) { _file_hash = hash ; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/** Overloaded QWidget.show */
|
/** Overloaded QWidget.show */
|
||||||
|
@ -56,10 +60,13 @@ public slots:
|
||||||
void setCompleted(const qulonglong & completed);
|
void setCompleted(const qulonglong & completed);
|
||||||
void setRemaining(const qulonglong & remaining) ;
|
void setRemaining(const qulonglong & remaining) ;
|
||||||
void setType(const QString & type);
|
void setType(const QString & type);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent (QCloseEvent * event);
|
void closeEvent (QCloseEvent * event);
|
||||||
|
|
||||||
|
virtual void showEvent(QShowEvent * event);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_ok_dButton_clicked();
|
void on_ok_dButton_clicked();
|
||||||
void on_cancel_dButton_clicked();
|
void on_cancel_dButton_clicked();
|
||||||
|
@ -68,6 +75,7 @@ private:
|
||||||
|
|
||||||
class QStandardItemModel *CommentsModel;
|
class QStandardItemModel *CommentsModel;
|
||||||
|
|
||||||
|
std::string _file_hash ;
|
||||||
|
|
||||||
|
|
||||||
/** Qt Designer generated object */
|
/** Qt Designer generated object */
|
||||||
|
|
|
@ -201,13 +201,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="remaining_label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Remaining:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QLabel" name="sources_line">
|
<widget class="QLabel" name="sources_line">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -229,18 +222,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="0" column="2" rowspan="7">
|
||||||
<widget class="QLabel" name="remaining_line">
|
|
||||||
<property name="text">
|
|
||||||
<string><!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></string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2" rowspan="4">
|
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
|
@ -253,6 +235,58 @@ p, li { white-space: pre-wrap; }
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QLabel" name="chunksizelabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Chunks Label</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Chunk size:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QLabel" name="numberofchunkslabel">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Number of Chunks</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Chunks Number Label</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Number of Chunks</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Chunks:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
|
<widget class="QLabel" name="remaining_line">
|
||||||
|
<property name="text">
|
||||||
|
<string><!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></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="remaining_label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remaining:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -384,16 +384,18 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
|
||||||
contextMnu.addAction( cancelAct);
|
contextMnu.addAction( cancelAct);
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
}
|
}
|
||||||
#ifndef RS_RELEASE_VERSION
|
|
||||||
if(single)
|
if(single)
|
||||||
{
|
{
|
||||||
|
#ifndef RS_RELEASE_VERSION
|
||||||
contextMnu.addAction( openfileAct);
|
contextMnu.addAction( openfileAct);
|
||||||
contextMnu.addAction( previewfileAct);
|
contextMnu.addAction( previewfileAct);
|
||||||
contextMnu.addAction( openfolderAct);
|
#endif
|
||||||
|
contextMnu.addAction( openfolderAct);
|
||||||
contextMnu.addAction( detailsfileAct);
|
contextMnu.addAction( detailsfileAct);
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
contextMnu.addAction( clearcompletedAct);
|
contextMnu.addAction( clearcompletedAct);
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
#ifndef RS_RELEASE_VERSION
|
#ifndef RS_RELEASE_VERSION
|
||||||
|
@ -1156,6 +1158,8 @@ void TransfersDialog::showDetailsDialog()
|
||||||
|
|
||||||
QModelIndexList lst = ui.downloadList->selectionModel ()->selectedIndexes ();
|
QModelIndexList lst = ui.downloadList->selectionModel ()->selectedIndexes ();
|
||||||
RetroShareLinkAnalyzer analyzer;
|
RetroShareLinkAnalyzer analyzer;
|
||||||
|
|
||||||
|
std::string file_hash ;
|
||||||
|
|
||||||
for (int i = 0; i < lst.count (); i++)
|
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 fcompleted = ind.model ()->data (ind.model ()->index (ind.row (), COMPLETED)).toULongLong() ;
|
||||||
qulonglong fremaining = ind.model ()->data (ind.model ()->index (ind.row (), REMAINING)).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
|
// Set Details.. Window Title
|
||||||
detailsdlg->setWindowTitle(tr("Details:") + fname);
|
detailsdlg->setWindowTitle(tr("Details:") + fname);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue