Simplify natural sort classes interface

Now the comparison function/class should be constructed before usage.
This change also make it easier to plug in into various containers which
will require a compare function type (such as std::set).
This commit is contained in:
Chocobo1 2021-04-05 13:02:28 +08:00
parent 5045fa6dcd
commit a64bb1a990
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
24 changed files with 235 additions and 177 deletions

View file

@ -47,6 +47,7 @@
#include "base/rss/rss_feed.h"
#include "base/rss/rss_folder.h"
#include "base/rss/rss_session.h"
#include "base/utils/compare.h"
#include "base/utils/fs.h"
#include "base/utils/string.h"
#include "gui/autoexpandabledialog.h"
@ -330,7 +331,7 @@ void AutomatedRssDownloader::initCategoryCombobox()
{
// Load torrent categories
QStringList categories = BitTorrent::Session::instance()->categories().keys();
std::sort(categories.begin(), categories.end(), Utils::String::naturalLessThan<Qt::CaseInsensitive>);
std::sort(categories.begin(), categories.end(), Utils::Compare::NaturalLessThan<Qt::CaseInsensitive>());
m_ui->comboCategory->addItem("");
m_ui->comboCategory->addItems(categories);
}