18 "Regular Expression for what to ignore when sorting");
59 ? Qt::CaseSensitive : Qt::CaseInsensitive;
83 Qt::CaseSensitivity case_sensitive,
86 m_caseSensitive(case_sensitive),
87 m_prefixMode(prefix_mode),
88 m_exclusions(
std::move(exclusions))
104 if (other ==
nullptr)
106 LOG(VB_GENERAL, LOG_ERR,
107 QString(
"MythSortHelper created from null pointer."));
120static std::shared_ptr<MythSortHelper>
singleton =
nullptr;
133 singleton = std::make_shared<MythSortHelper>();
165 QString ltitle = title;
167 ltitle = ltitle.toLower();
175 for (
const auto& str : std::as_const(
m_exclList))
176 if (ltitle.startsWith(str))
198 QString lpathname = pathname;
200 lpathname = lpathname.toLower();
203 QStringList parts = lpathname.split(
"/");
205 for (
int i = 0; i < parts.size(); ++i) {
207 [&parts,i](
const QString& excl)
208 { return parts[i].startsWith(excl); } ))
215 return parts.join(
"/");
QString GetSetting(const QString &key, const QString &defaultval="")
bool GetBoolSetting(const QString &key, bool defaultval=false)
A class to consolidate all the soring functions.
Qt::CaseSensitivity m_caseSensitive
Whether sorting two strings should ignore upper/lower case.
SortPrefixMode m_prefixMode
Whether or not to ignore prefix words (like A, An, and The) when sorting two strings.
bool hasPrefixes(void)
Does the language translation specify any prefixes.
QStringList m_exclList
The m_exclusion string converted into a string list.
QRegularExpression m_prefixesRegex2
A regular expression used for moving leading prefix to the end of a string.
QString doPathname(const QString &pathname) const
Create the sortable form of an item.
QRegularExpression m_prefixesRegex
A regular expression used for removing a leading prefix.
QString m_exclusions
A string containing names that should be ignored when greating the sortable form of a title.
QString doTitle(const QString &title) const
Create the sortable form of an title string.
QString m_prefixes
A string containing the regular expression of prefixes to ignore when sorting.
void MythSortHelperCommon(void)
Common code for creating a MythSortHelper object.
MythSortHelper()
Create a MythSortHelper object.
SortExclusionMode m_exclMode
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
static std::shared_ptr< MythSortHelper > singleton
std::shared_ptr< MythSortHelper > getMythSortHelper(void)
Get a pointer to the MythSortHelper singleton.
void resetMythSortHelper(void)
Delete the MythSortHelper singleton.