priority actions added

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1439 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
alexandrut 2009-07-27 17:22:56 +00:00
parent 874f2bb8fd
commit 0fa44603ad
2 changed files with 92 additions and 3 deletions

View File

@ -251,6 +251,26 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
viewMenu->addAction(rootisnotdecoratedAct); viewMenu->addAction(rootisnotdecoratedAct);
viewMenu->addAction(rootisdecoratedAct); viewMenu->addAction(rootisdecoratedAct);
clearQueuedDwlAct = new QAction(QIcon(), tr("Clear from Queue"), this);
connect(clearQueuedDwlAct, SIGNAL(triggered()), this, SLOT(clearQueuedDwl()));
clearQueueAct = new QAction(QIcon(), tr("Clear Queue"), this);
connect(clearQueueAct, SIGNAL(triggered()), this, SLOT(clearQueue()));
priorityLowAct = new QAction(QIcon(), tr("Low Priority"), this);
connect(priorityLowAct, SIGNAL(triggered()), this, SLOT(priorityLow()));
priorityNormalAct = new QAction(QIcon(), tr("Normal Priority"), this);
connect(priorityNormalAct, SIGNAL(triggered()), this, SLOT(priorityNormal()));
priorityHighAct = new QAction(QIcon(), tr("High Priority"), this);
connect(priorityHighAct, SIGNAL(triggered()), this, SLOT(priorityHigh()));
priorityAutoAct = new QAction(QIcon(), tr("Auto Priority"), this);
connect(priorityAutoAct, SIGNAL(triggered()), this, SLOT(priorityAuto()));
QMenu *priorityMenu = new QMenu(tr("Change priority as..."), this);
priorityMenu->addAction(priorityLowAct);
priorityMenu->addAction(priorityNormalAct);
priorityMenu->addAction(priorityHighAct);
priorityMenu->addAction(priorityAutoAct);
contextMnu.clear(); contextMnu.clear();
if (addPlayOption) if (addPlayOption)
{ {
@ -269,6 +289,10 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
contextMnu.addSeparator(); contextMnu.addSeparator();
contextMnu.addAction( copylinkAct); contextMnu.addAction( copylinkAct);
contextMnu.addAction( pastelinkAct); contextMnu.addAction( pastelinkAct);
contextMnu.addSeparator();
contextMnu.addAction( clearQueuedDwlAct);
contextMnu.addAction( clearQueueAct);
contextMnu.addMenu( priorityMenu);
contextMnu.addSeparator(); contextMnu.addSeparator();
contextMnu.addMenu( viewMenu); contextMnu.addMenu( viewMenu);
contextMnu.exec( mevent->globalPos() ); contextMnu.exec( mevent->globalPos() );
@ -1094,6 +1118,53 @@ void TransfersDialog::openTransfer()
} }
} }
/* clear download or all queue - for pending dwls */
void TransfersDialog::clearQueuedDwl()
{
QList<QStandardItem *> items;
QList<QStandardItem *>::iterator it;
getIdOfSelectedItems(items);
for (it = items.begin(); it != items.end(); it ++) {
std::string hash = (*it)->data(Qt::DisplayRole).toString().toStdString();
rsFiles->clearDownload(hash);
}
}
void TransfersDialog::clearQueue()
{
rsFiles->clearQueue();
}
/* modify download priority actions */
void TransfersDialog::priorityLow()
{
changePriority(0);
}
void TransfersDialog::priorityNormal()
{
changePriority(1);
}
void TransfersDialog::priorityHigh()
{
changePriority(2);
}
void TransfersDialog::priorityAuto()
{
changePriority(3);
}
void TransfersDialog::changePriority(int priority)
{
QList<QStandardItem *> items;
QList<QStandardItem *>::iterator it;
getIdOfSelectedItems(items);
for (it = items.begin(); it != items.end(); it ++) {
std::string hash = (*it)->data(Qt::DisplayRole).toString().toStdString();
rsFiles->changePriority(hash, priority);
}
}
void TransfersDialog::clearcompleted() void TransfersDialog::clearcompleted()
{ {
std::cerr << "TransfersDialog::clearcompleted()" << std::endl; std::cerr << "TransfersDialog::clearcompleted()" << std::endl;

View File

@ -77,6 +77,16 @@ class TransfersDialog : public MainPage
void openTransfer(); void openTransfer();
void previewTransfer(); void previewTransfer();
/** clear download or all queue - for pending dwls */
void clearQueuedDwl();
void clearQueue();
/** modify download priority actions */
void priorityLow();
void priorityNormal();
void priorityHigh();
void priorityAuto();
signals: signals:
void playFiles(QStringList files); void playFiles(QStringList files);
@ -115,9 +125,17 @@ class TransfersDialog : public MainPage
QAction *openfolderAct; QAction *openfolderAct;
QAction *openfileAct; QAction *openfileAct;
QAction *previewfileAct; QAction *previewfileAct;
QAction *clearQueuedDwlAct;
QAction *clearQueueAct;
QAction *changePriorityAct;
QAction *priorityLowAct;
QAction *priorityNormalAct;
QAction *priorityHighAct;
QAction *priorityAutoAct;
void getIdOfSelectedItems(QList<QStandardItem *>& items); void getIdOfSelectedItems(QList<QStandardItem *>& items);
bool controlTransferFile(uint32_t flags); bool controlTransferFile(uint32_t flags);
void changePriority(int priority);
QTreeView *downloadList; QTreeView *downloadList;