Go to the documentation of this file.
17 "Regular Expression for what to ignore when sorting");
58 ? Qt::CaseSensitive : Qt::CaseInsensitive;
82 Qt::CaseSensitivity case_sensitive,
85 m_caseSensitive(case_sensitive),
86 m_prefixMode(prefix_mode),
87 m_exclusions(
std::move(exclusions))
103 if (other ==
nullptr)
105 LOG(VB_GENERAL, LOG_ERR,
106 QString(
"MythSortHelper created from null pointer."));
119 static std::shared_ptr<MythSortHelper>
singleton =
nullptr;
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(
"/");
SortExclusionMode m_exclMode
QString m_prefixes
A string containing the regular expression of prefixes to ignore when sorting.
std::shared_ptr< MythSortHelper > getMythSortHelper(void)
Get a pointer to the MythSortHelper singleton.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
A class to consolidate all the soring functions.
Qt::CaseSensitivity m_caseSensitive
Whether sorting two strings should ignore upper/lower case.
QString m_exclusions
A string containing names that should be ignored when greating the sortable form of a title.
QString doPathname(const QString &pathname) const
Create the sortable form of an item.
QString doTitle(const QString &title) const
Create the sortable form of an title string.
void MythSortHelperCommon(void)
Common code for creating a MythSortHelper object.
QStringList m_exclList
The m_exclusion string converted into a string list.
MythSortHelper()
Create a MythSortHelper object.
SortPrefixMode m_prefixMode
Whether or not to ignore prefix words (like A, An, and The) when sorting two strings.
QRegularExpression m_prefixesRegex2
A regular expression used for moving leading prefix to the end of a string.
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
bool hasPrefixes(void)
Does the language translation specify any prefixes.
bool GetBoolSetting(const QString &key, bool defaultval=false)
QRegularExpression m_prefixesRegex
A regular expression used for removing a leading prefix.
void resetMythSortHelper(void)
Delete the MythSortHelper singleton.
static std::shared_ptr< MythSortHelper > singleton
QString GetSetting(const QString &key, const QString &defaultval="")