mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-12 16:15:43 -04:00
- put FileTransferInfoWidget into DetailsDialog, in replacement of previous information display
- corrected bug with DetailsDialog auto-deleting itself when closed - made TransferDialog a single tab widget. Gives more room to each of the tabs, especially search. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-ImprovedGUI@6135 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
130e7eb7d7
commit
de8b10bd01
7 changed files with 292 additions and 899 deletions
|
@ -20,11 +20,15 @@
|
|||
****************************************************************/
|
||||
|
||||
#include <QStandardItemModel>
|
||||
#include <QClipboard>
|
||||
|
||||
#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<FileTransferInfoWidget*>(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));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue