mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 13:23:34 -07:00
Fix "Select All/None" buttons in torrent properties
This commit is contained in:
parent
b3d8f2400f
commit
dbfef8665b
3 changed files with 30 additions and 3 deletions
|
@ -83,8 +83,8 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, GUI* main_window, TransferLi
|
||||||
|
|
||||||
// SIGNAL/SLOTS
|
// SIGNAL/SLOTS
|
||||||
connect(filesList, SIGNAL(clicked(const QModelIndex&)), filesList, SLOT(edit(const QModelIndex&)));
|
connect(filesList, SIGNAL(clicked(const QModelIndex&)), filesList, SLOT(edit(const QModelIndex&)));
|
||||||
connect(selectAllButton, SIGNAL(clicked()), PropListModel, SLOT(selectAll()));
|
connect(selectAllButton, SIGNAL(clicked()), this, SLOT(selectAllFiles()));
|
||||||
connect(selectNoneButton, SIGNAL(clicked()), PropListModel, SLOT(selectNone()));
|
connect(selectNoneButton, SIGNAL(clicked()), this, SLOT(selectNoneFiles()));
|
||||||
connect(filesList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayFilesListMenu(const QPoint&)));
|
connect(filesList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayFilesListMenu(const QPoint&)));
|
||||||
connect(filesList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(openDoubleClickedFile(QModelIndex)));
|
connect(filesList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(openDoubleClickedFile(QModelIndex)));
|
||||||
connect(PropListModel, SIGNAL(filteredFilesChanged()), this, SLOT(filteredFilesChanged()));
|
connect(PropListModel, SIGNAL(filteredFilesChanged()), this, SLOT(filteredFilesChanged()));
|
||||||
|
@ -395,6 +395,7 @@ void PropertiesWidget::loadDynamicData() {
|
||||||
// Expand first item if possible
|
// Expand first item if possible
|
||||||
filesList->expand(PropListModel->index(0, 0));
|
filesList->expand(PropListModel->index(0, 0));
|
||||||
}
|
}
|
||||||
|
qDebug("Updating priorities in files tab");
|
||||||
std::vector<size_type> fp;
|
std::vector<size_type> fp;
|
||||||
h.file_progress(fp);
|
h.file_progress(fp);
|
||||||
PropListModel->updateFilesPriorities(h.file_priorities());
|
PropListModel->updateFilesPriorities(h.file_priorities());
|
||||||
|
@ -404,6 +405,28 @@ void PropertiesWidget::loadDynamicData() {
|
||||||
} catch(invalid_handle e) {}
|
} catch(invalid_handle e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PropertiesWidget::selectAllFiles() {
|
||||||
|
// Update torrent properties
|
||||||
|
std::vector<int> prio = h.file_priorities();
|
||||||
|
for(std::vector<int>::iterator it = prio.begin(); it != prio.end(); it++) {
|
||||||
|
if(*it == IGNORED) {
|
||||||
|
*it = NORMAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
h.prioritize_files(prio);
|
||||||
|
// Update model
|
||||||
|
PropListModel->selectAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PropertiesWidget::selectNoneFiles() {
|
||||||
|
// Update torrent properties
|
||||||
|
std::vector<int> prio;
|
||||||
|
prio.assign(h.num_files(), IGNORED);
|
||||||
|
h.prioritize_files(prio);
|
||||||
|
// Update model
|
||||||
|
PropListModel->selectNone();
|
||||||
|
}
|
||||||
|
|
||||||
void PropertiesWidget::loadUrlSeeds(){
|
void PropertiesWidget::loadUrlSeeds(){
|
||||||
listWebSeeds->clear();
|
listWebSeeds->clear();
|
||||||
qDebug("Loading URL seeds");
|
qDebug("Loading URL seeds");
|
||||||
|
|
|
@ -101,6 +101,8 @@ protected slots:
|
||||||
void showPiecesAvailability(bool show);
|
void showPiecesAvailability(bool show);
|
||||||
void updateSavePath(QTorrentHandle& h);
|
void updateSavePath(QTorrentHandle& h);
|
||||||
void renameSelectedFile();
|
void renameSelectedFile();
|
||||||
|
void selectAllFiles();
|
||||||
|
void selectNoneFiles();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void loadDynamicData();
|
void loadDynamicData();
|
||||||
|
|
|
@ -558,7 +558,9 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void selectAll() {
|
void selectAll() {
|
||||||
for(int i=0; i<rootItem->childCount(); ++i) {
|
for(int i=0; i<rootItem->childCount(); ++i) {
|
||||||
rootItem->child(i)->setPriority(NORMAL);
|
TreeItem *child = rootItem->child(i);
|
||||||
|
if(child->getPriority() == IGNORED)
|
||||||
|
child->setPriority(NORMAL);
|
||||||
}
|
}
|
||||||
emit layoutChanged();
|
emit layoutChanged();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue