Go to the documentation of this file.
22 "(\\d+)x(\\d*)", QRegularExpression::CaseInsensitiveOption };
24 "-(\\d+)([dwmy])", QRegularExpression::CaseInsensitiveOption };
26 #if QT_VERSION < QT_VERSION_CHECK(5,15,2)
27 #define capturedView capturedRef
31 const QString& _prefix)
33 if (_prefix.isEmpty())
39 if (loaddefaultsettings)
206 matches = (matches ||
208 matches = (matches ||
210 matches = (matches ||
227 auto samegenre = [
this](
const auto & g) {
return g.first ==
m_genre; };
228 matches = std::any_of(gl.cbegin(), gl.cend(), samegenre);
234 auto samecountry = [
this](
const auto & c) {
return c.first ==
m_country; };
235 matches = std::any_of(cl.cbegin(), cl.cend(), samecountry);
248 auto samecast = [
this](
const auto & c){
return c.first ==
m_cast; };
249 matches = std::any_of(cl.cbegin(), cl.cend(), samecast);
262 matches = ((mdata.
GetYear() == 0) ||
351 LOG(VB_GENERAL, LOG_ERR, QString(
"Error: unknown sort type %1")
362 if (match.hasMatch())
364 m_season = match.capturedView(1).isEmpty()
365 ? -1 : match.capturedView(1).toInt();
366 m_episode = match.capturedView(2).isEmpty()
367 ? -1 : match.capturedView(2).toInt();
370 m_textFilter.remove(match.capturedStart(), match.capturedLength());
380 if (match.hasMatch())
382 int64_t modnr = match.capturedView(1).toInt();
384 switch(match.capturedView(2).at(0).toLatin1())
386 case 'd': testdate = testdate.addDays(-modnr);
break;
387 case 'w': testdate = testdate.addDays(-modnr * 7);
break;
388 case 'm': testdate = testdate.addMonths(-modnr);
break;
389 case 'y': testdate = testdate.addYears(-modnr);
break;
392 m_textFilter.remove(match.capturedStart(), match.capturedLength());
407 m_videoList(*video_list)
445 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'filter'");
504 bool have_unknown_year =
false;
505 bool have_unknown_runtime =
false;
507 using int_list = std::set<int>;
510 int_list user_ratings;
514 for (
const auto & md : mdl)
516 int year = md->GetYear();
518 have_unknown_year =
true;
522 std::chrono::minutes runtime = md->GetLength();
524 have_unknown_runtime =
true;
526 runtimes.insert(runtime.count() / 30);
528 user_ratings.insert(
static_cast<int>(md->GetUserRating()));
537 for (
const auto & vc : vcl)
548 for (
const auto & g : gl)
558 for (
const auto & c : cl)
568 for (
const auto & cn : cnl)
583 if (have_unknown_year)
592 if (have_unknown_runtime)
596 for (
int runtime : runtimes)
598 QString s = QString(
"%1 %2 ~ %3 %4").arg(runtime * 30).arg(tr(
"minutes"))
599 .arg((runtime + 1) * 30).arg(tr(
"minutes"));
609 for (
auto p = user_ratings.crbegin();
p != user_ratings.crend(); ++
p)
612 QString(
">= %1").arg(QString::number(*
p)),
622 QCoreApplication::translate(
"(Common)",
"Yes"), QVariant::fromValue(1));
624 QCoreApplication::translate(
"(Common)",
"No"), QVariant::fromValue(0));
631 QCoreApplication::translate(
"(Common)",
"Yes"), QVariant::fromValue(1));
633 QCoreApplication::translate(
"(Common)",
"No"), QVariant::fromValue(0));
652 QCoreApplication::translate(
"(Common)",
"Title"),
655 QCoreApplication::translate(
"(Common)",
"Season/Episode"),
658 QCoreApplication::translate(
"(Common)",
"Year"),
661 QCoreApplication::translate(
"(Common)",
"User Rating"),
664 QCoreApplication::translate(
"(Common)",
"Runtime"),
667 QCoreApplication::translate(
"(Common)",
"Filename"),
696 int new_year = item->
GetData().toInt();
void SetWatched(MythUIButtonListItem *item)
VideoFilterSettings(bool loaddefaultsettings=true, const QString &_prefix="")
const QString VIDEO_YEAR_UNKNOWN
ParentalLevel::Level m_parentalLevel
void SetCategory(MythUIButtonListItem *item)
void setGenre(int lgenre)
MythUIButtonList * m_genreList
const QString VIDEO_RUNTIME_UNKNOWN
static const QRegularExpression kReDate
void setGenre(MythUIButtonListItem *item)
bool naturalSortCompare(const QString &a, const QString &b, Qt::CaseSensitivity caseSensitivity=Qt::CaseSensitive)
naturalCompare as a std::sort compatible function (ignoring the third parameter, which is never used)...
@ kFilterUserRatingChanged
MythUIButtonList * m_watchedList
@ kFilterCoverFileChanged
int GetUserRating() const
void SetCast(MythUIButtonListItem *item)
MythUIButtonList * m_orderByList
@ kOrderByUserRatingDescending
int TryFilter(const VideoFilterSettings &filter) const
MythUIButton * m_doneButton
VideoFilterDialog(MythScreenStack *lparent, const QString &lname, VideoList *video_list)
MythUIButtonList * m_browseList
MythUIButton * m_saveButton
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Screen in which all other widgets are contained and rendered.
QString GetText(void) const
void setOrderby(ordering lorderby)
const QString VIDEO_CATEGORY_UNKNOWN
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
duration< CHRONO_TYPE, ratio< 31556952 > > years
void SetCoverFile(int coverfile)
void SetInetRef(int inetref)
MythUITextEdit * m_textFilter
void SetYear(MythUIButtonListItem *item)
void SetText(const QString &text, bool moveCursor=true)
MythUIButtonList * m_countryList
MythUIButtonList * m_runtimeList
static const QRegularExpression kReSeason
static VideoGenre & getGenre()
void setRunTime(MythUIButtonListItem *item)
@ kFilterParentalLevelChanged
void SetUserRating(MythUIButtonListItem *item)
ordering getOrderby() const
const VideoList & m_videoList
const QString VIDEO_COUNTRY_UNKNOWN
MythUIButtonList * m_inetRefList
QString getTextFilter() const
VideoFilterSettings & operator=(const VideoFilterSettings &rhs)
const QString VIDEO_CAST_UNKNOWN
void BuildFocusList(void)
void SetBrowse(MythUIButtonListItem *item)
static VideoCountry & getCountry()
const QString VIDEO_GENRE_UNKNOWN
VideoFilterSettings m_settings
unsigned int m_changedState
static VideoCategory & GetCategory()
virtual void setSettings(const VideoFilterSettings &settings)=0
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
@ kOrderByDateAddedDescending
int GetNumSetting(const QString &key, int defaultval=0)
const QString VIDEO_INETREF_DEFAULT
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
virtual const VideoFilterSettings & getSettings()=0
bool IsDefaultCoverFile(const QString &coverfile)
MythUIButtonList * m_yearList
void setTextFilter(const QString &val)
const entry_list & getList()
void SetBrowse(int lbrowse)
MythUIButtonList * m_categoryList
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
static VideoCast & GetCast()
void SetWatched(int lwatched)
unsigned int getChangedState()
FilterSettingsProxy * m_fsp
void SetUserRating(int luserrating)
virtual void SetText(const QString &text)
@ kFilterTextFilterChanged
void SetInetRef(MythUIButtonListItem *item)
MythUIButtonList * m_coverFileList
void SetCategory(int lcategory)
void setRuntime(int lruntime)
std::vector< entry > entry_list
void setOrderby(MythUIButtonListItem *item)
MythUIButtonList * m_userRatingList
void SaveSetting(const QString &key, int newValue)
MythUIText * m_numVideosText
MythUIButtonList * m_castList
bool matches_filter(const VideoMetadata &mdata) const
~VideoFilterDialog() override
bool meta_less_than(const VideoMetadata &lhs, const VideoMetadata &rhs) const
Compares two VideoMetadata instances.
const VideoMetadataListManager & getListCache() const
void setCountry(int lcountry)
void SetCoverFile(MythUIButtonListItem *item)
void setCountry(MythUIButtonListItem *item)