Go to the documentation of this file.
17 "Regular Expression for what to ignore when sorting");
34 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
62 ? Qt::CaseSensitive : Qt::CaseInsensitive;
86 Qt::CaseSensitivity case_sensitive,
89 m_caseSensitive(case_sensitive),
90 m_prefixMode(prefix_mode),
91 m_exclusions(
std::move(exclusions))
107 if (other ==
nullptr)
109 LOG(VB_GENERAL, LOG_ERR,
110 QString(
"MythSortHelper created from null pointer."));
123 static std::shared_ptr<MythSortHelper>
singleton =
nullptr;
169 QString ltitle = title;
171 ltitle = ltitle.toLower();
180 if (ltitle.startsWith(str))
202 QString lpathname = pathname;
204 lpathname = lpathname.toLower();
207 QStringList parts = lpathname.split(
"/");
209 for (
int i = 0; i < parts.size(); ++i) {
211 [&parts,i](
const QString& excl)
212 { return parts[i].startsWith(excl); } ))
219 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="")