mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 15:37:26 -06:00
Fix several signals/slots bindings
Drop backward compatiblity functions for qBT <= 1.4.0 Clean up torrent loading code (Use priority queue instead of insertion sort)
This commit is contained in:
46
src/misc.h
46
src/misc.h
@@ -423,52 +423,6 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
// Insertion sort, used instead of bubble sort because it is
|
||||
// approx. 5 times faster.
|
||||
template <class T> static void insertSort(QList<QPair<int, T> > &list, const QPair<int, T>& value, Qt::SortOrder sortOrder) {
|
||||
int i = 0;
|
||||
if(sortOrder == Qt::AscendingOrder) {
|
||||
while(i < list.size() and value.second > list.at(i).second) {
|
||||
++i;
|
||||
}
|
||||
}else{
|
||||
while(i < list.size() and value.second < list.at(i).second) {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
list.insert(i, value);
|
||||
}
|
||||
|
||||
template <class T> static void insertSort2(QList<QPair<int, T> > &list, const QPair<int, T>& value, Qt::SortOrder sortOrder=Qt::AscendingOrder) {
|
||||
int i = 0;
|
||||
if(sortOrder == Qt::AscendingOrder) {
|
||||
while(i < list.size() and value.first > list.at(i).first) {
|
||||
++i;
|
||||
}
|
||||
}else{
|
||||
while(i < list.size() and value.first < list.at(i).first) {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
list.insert(i, value);
|
||||
}
|
||||
|
||||
// Can't use template class for QString because >,< use unicode code for sorting
|
||||
// which is not what a human would expect when sorting strings.
|
||||
static void insertSortString(QList<QPair<int, QString> > &list, const QPair<int, QString> &value, Qt::SortOrder sortOrder) {
|
||||
int i = 0;
|
||||
if(sortOrder == Qt::AscendingOrder) {
|
||||
while(i < list.size() and QString::localeAwareCompare(value.second, list.at(i).second) > 0) {
|
||||
++i;
|
||||
}
|
||||
}else{
|
||||
while(i < list.size() and QString::localeAwareCompare(value.second, list.at(i).second) < 0) {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
list.insert(i, value);
|
||||
}
|
||||
|
||||
static bool removeEmptyTree(QString path) {
|
||||
QDir dir(path);
|
||||
foreach(const QString &child, dir.entryList(QDir::AllDirs)) {
|
||||
|
||||
Reference in New Issue
Block a user