mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Add Expand/Collapse All in Upload List
And don't make child item if only one peer.
This commit is contained in:
parent
4b1161dc0b
commit
dff0d50b92
@ -412,10 +412,14 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
||||
connect(renameFileAct, SIGNAL(triggered()), this, SLOT(renameFile()));
|
||||
specifyDestinationDirectoryAct = new QAction(QIcon(IMAGE_SEARCH),tr("Specify..."),this) ;
|
||||
connect(specifyDestinationDirectoryAct,SIGNAL(triggered()),this,SLOT(chooseDestinationDirectory()));
|
||||
expandAllAct= new QAction(QIcon(IMAGE_EXPAND),tr("Expand all"),this);
|
||||
connect(expandAllAct,SIGNAL(triggered()),this,SLOT(expandAll()));
|
||||
collapseAllAct= new QAction(QIcon(IMAGE_COLLAPSE),tr("Collapse all"),this);
|
||||
connect(collapseAllAct,SIGNAL(triggered()),this,SLOT(collapseAll()));
|
||||
expandAllDLAct= new QAction(QIcon(IMAGE_EXPAND),tr("Expand all"),this);
|
||||
connect(expandAllDLAct,SIGNAL(triggered()),this,SLOT(expandAllDL()));
|
||||
collapseAllDLAct= new QAction(QIcon(IMAGE_COLLAPSE),tr("Collapse all"),this);
|
||||
connect(collapseAllDLAct,SIGNAL(triggered()),this,SLOT(collapseAllDL()));
|
||||
expandAllULAct= new QAction(QIcon(IMAGE_EXPAND),tr("Expand all"),this);
|
||||
connect(expandAllULAct,SIGNAL(triggered()),this,SLOT(expandAllUL()));
|
||||
collapseAllULAct= new QAction(QIcon(IMAGE_COLLAPSE),tr("Collapse all"),this);
|
||||
connect(collapseAllULAct,SIGNAL(triggered()),this,SLOT(collapseAllUL()));
|
||||
collCreateAct= new QAction(QIcon(IMAGE_COLLCREATE), tr("Create Collection..."), this);
|
||||
connect(collCreateAct,SIGNAL(triggered()),this,SLOT(collCreate()));
|
||||
collModifAct= new QAction(QIcon(IMAGE_COLLMODIF), tr("Modify Collection..."), this);
|
||||
@ -777,8 +781,8 @@ void TransfersDialog::downloadListCustomPopupMenu( QPoint /*point*/ )
|
||||
}//if (add_CopyLink || add_PasteLink)
|
||||
|
||||
if (DLLFilterModel->rowCount()>0 ) {
|
||||
contextMnu.addAction( expandAllAct ) ;
|
||||
contextMnu.addAction( collapseAllAct ) ;
|
||||
contextMnu.addAction( expandAllDLAct ) ;
|
||||
contextMnu.addAction( collapseAllDLAct ) ;
|
||||
}
|
||||
|
||||
contextMnu.addSeparator() ;//-----------------------------------------------
|
||||
@ -844,6 +848,14 @@ void TransfersDialog::uploadsListCustomPopupMenu( QPoint /*point*/ )
|
||||
if (add_CopyLink)
|
||||
contextMnu.addAction( ulCopyLinkAct);
|
||||
|
||||
if (ULListModel->rowCount()>0 ) {
|
||||
if(single || add_CopyLink)
|
||||
contextMnu.addSeparator() ;//-----------------------------------------------
|
||||
|
||||
contextMnu.addAction( expandAllULAct ) ;
|
||||
contextMnu.addAction( collapseAllULAct ) ;
|
||||
}
|
||||
|
||||
contextMnu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
@ -1176,9 +1188,15 @@ int TransfersDialog::addULItem(int row, const FileInfo &fileInfo)
|
||||
|
||||
ULListModel->setData(ULListModel->index(row, COLUMN_USIZE), QVariant((qlonglong)fileSize));
|
||||
|
||||
//Reset Parent info if child present
|
||||
ULListModel->setData(ULListModel->index(row, COLUMN_UNAME), QVariant(QString()), Qt::ToolTipRole);
|
||||
ULListModel->setData(ULListModel->index(row, COLUMN_UTRANSFERRED), QVariant());
|
||||
ULListModel->setData(ULListModel->index(row, COLUMN_UPROGRESS), QVariant());
|
||||
|
||||
QStandardItem *ulItem = ULListModel->item(row);
|
||||
std::set<int> used_rows ;
|
||||
double peerULSpeedTotal = 0;
|
||||
bool bOnlyOne = ( fileInfo.peers.size() == 1 );
|
||||
|
||||
for(std::list<TransferInfo>::const_iterator pit = fileInfo.peers.begin()
|
||||
; pit != fileInfo.peers.end(); ++pit)
|
||||
@ -1219,9 +1237,17 @@ int TransfersDialog::addULItem(int row, const FileInfo &fileInfo)
|
||||
peerpinfo.progress = (fileInfo.size>0)?((transferInfo.transfered % chunk_size)*100.0/fileInfo.size):0 ;
|
||||
}
|
||||
|
||||
if (bOnlyOne)
|
||||
{
|
||||
//Only one peer so update parent
|
||||
ULListModel->setData(ULListModel->index(row, COLUMN_UNAME), QVariant(getPeerName(transferInfo.peerId)), Qt::ToolTipRole);
|
||||
ULListModel->setData(ULListModel->index(row, COLUMN_UTRANSFERRED), QVariant(completed));
|
||||
ULListModel->setData(ULListModel->index(row, COLUMN_UPROGRESS), QVariant::fromValue(peerpinfo));
|
||||
} else {
|
||||
int row_id = addPeerToULItem(ulItem, transferInfo.peerId, hashFileAndPeerId, completed, peerULSpeed, peerpinfo);
|
||||
|
||||
used_rows.insert(row_id);
|
||||
}
|
||||
peerULSpeedTotal += peerULSpeed;
|
||||
|
||||
}
|
||||
@ -2280,15 +2306,24 @@ void TransfersDialog::setShowDLPath(bool show)
|
||||
}
|
||||
}
|
||||
|
||||
void TransfersDialog::expandAll()
|
||||
void TransfersDialog::expandAllDL()
|
||||
{
|
||||
ui.downloadList->expandAll();
|
||||
}
|
||||
void TransfersDialog::collapseAll()
|
||||
void TransfersDialog::collapseAllDL()
|
||||
{
|
||||
ui.downloadList->collapseAll();
|
||||
}
|
||||
|
||||
void TransfersDialog::expandAllUL()
|
||||
{
|
||||
ui.uploadsList->expandAll();
|
||||
}
|
||||
void TransfersDialog::collapseAllUL()
|
||||
{
|
||||
ui.uploadsList->collapseAll();
|
||||
}
|
||||
|
||||
void TransfersDialog::filterChanged(const QString& /*text*/)
|
||||
{
|
||||
int filterColumn = ui.filterLineEdit->currentFilter();
|
||||
|
@ -101,8 +101,10 @@ private slots:
|
||||
void setDestinationDirectory();
|
||||
void chooseDestinationDirectory();
|
||||
|
||||
void expandAll();
|
||||
void collapseAll();
|
||||
void expandAllDL();
|
||||
void collapseAllDL();
|
||||
void expandAllUL();
|
||||
void collapseAllUL();
|
||||
|
||||
// void rootdecorated();
|
||||
// void rootisnotdecorated();
|
||||
@ -207,8 +209,10 @@ private:
|
||||
QAction *detailsFileAct;
|
||||
QAction *renameFileAct;
|
||||
QAction *specifyDestinationDirectoryAct;
|
||||
QAction *expandAllAct;
|
||||
QAction *collapseAllAct;
|
||||
QAction *expandAllDLAct;
|
||||
QAction *collapseAllDLAct;
|
||||
QAction *expandAllULAct;
|
||||
QAction *collapseAllULAct;
|
||||
QAction *collCreateAct;
|
||||
QAction *collModifAct;
|
||||
QAction *collViewAct;
|
||||
|
Loading…
Reference in New Issue
Block a user