Go to the documentation of this file.
22 "(\\d+)x(\\d*)", QRegularExpression::CaseInsensitiveOption };
24 "-(\\d+)([dwmy])", QRegularExpression::CaseInsensitiveOption };
27 const QString& _prefix)
29 if (_prefix.isEmpty())
35 if (loaddefaultsettings)
202 matches = (matches ||
204 matches = (matches ||
206 matches = (matches ||
223 auto samegenre = [
this](
const auto & g) {
return g.first ==
m_genre; };
224 matches = std::any_of(gl.cbegin(), gl.cend(), samegenre);
230 auto samecountry = [
this](
const auto & c) {
return c.first ==
m_country; };
231 matches = std::any_of(cl.cbegin(), cl.cend(), samecountry);
244 auto samecast = [
this](
const auto & c){
return c.first ==
m_cast; };
245 matches = std::any_of(cl.cbegin(), cl.cend(), samecast);
258 matches = ((mdata.
GetYear() == 0) ||
347 LOG(VB_GENERAL, LOG_ERR, QString(
"Error: unknown sort type %1")
358 if (match.hasMatch())
360 m_season = match.capturedView(1).isEmpty()
361 ? -1 : match.capturedView(1).toInt();
362 m_episode = match.capturedView(2).isEmpty()
363 ? -1 : match.capturedView(2).toInt();
366 m_textFilter.remove(match.capturedStart(), match.capturedLength());
376 if (match.hasMatch())
378 int64_t modnr = match.capturedView(1).toInt();
380 switch(match.capturedView(2).at(0).toLatin1())
382 case 'd': testdate = testdate.addDays(-modnr);
break;
383 case 'w': testdate = testdate.addDays(-modnr * 7);
break;
384 case 'm': testdate = testdate.addMonths(-modnr);
break;
385 case 'y': testdate = testdate.addYears(-modnr);
break;
388 m_textFilter.remove(match.capturedStart(), match.capturedLength());
403 m_videoList(*video_list),
441 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'filter'");
500 bool have_unknown_year =
false;
501 bool have_unknown_runtime =
false;
503 using int_list = std::set<int>;
506 int_list user_ratings;
510 for (
const auto & md : mdl)
512 int year = md->GetYear();
514 have_unknown_year =
true;
518 std::chrono::minutes runtime = md->GetLength();
520 have_unknown_runtime =
true;
522 runtimes.insert(runtime.count() / 30);
524 user_ratings.insert(
static_cast<int>(md->GetUserRating()));
533 for (
const auto & vc : vcl)
544 for (
const auto & g : gl)
554 for (
const auto & c : cl)
564 for (
const auto & cn : cnl)
579 if (have_unknown_year)
588 if (have_unknown_runtime)
592 for (
int runtime : runtimes)
594 QString s = QString(
"%1 %2 ~ %3 %4").arg(runtime * 30).arg(tr(
"minutes"))
595 .arg((runtime + 1) * 30).arg(tr(
"minutes"));
605 for (
auto p = user_ratings.crbegin();
p != user_ratings.crend(); ++
p)
608 QString(
">= %1").arg(QString::number(*
p)),
618 QCoreApplication::translate(
"(Common)",
"Yes"), QVariant::fromValue(1));
620 QCoreApplication::translate(
"(Common)",
"No"), QVariant::fromValue(0));
627 QCoreApplication::translate(
"(Common)",
"Yes"), QVariant::fromValue(1));
629 QCoreApplication::translate(
"(Common)",
"No"), QVariant::fromValue(0));
648 QCoreApplication::translate(
"(Common)",
"Title"),
651 QCoreApplication::translate(
"(Common)",
"Season/Episode"),
654 QCoreApplication::translate(
"(Common)",
"Year"),
657 QCoreApplication::translate(
"(Common)",
"User Rating"),
660 QCoreApplication::translate(
"(Common)",
"Runtime"),
663 QCoreApplication::translate(
"(Common)",
"Filename"),
692 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)...
MythUIButtonList * m_watchedList
int GetUserRating() const
void SetCast(MythUIButtonListItem *item)
MythUIButtonList * m_orderByList
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
@ kOrderByUserRatingDescending
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
@ kFilterCoverFileChanged
MythUIButtonList * m_runtimeList
static const QRegularExpression kReSeason
static VideoGenre & getGenre()
void setRunTime(MythUIButtonListItem *item)
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
@ kFilterTextFilterChanged
static VideoCategory & GetCategory()
@ kFilterParentalLevelChanged
virtual void setSettings(const VideoFilterSettings &settings)=0
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
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)
@ kOrderByDateAddedDescending
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)
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
@ kFilterUserRatingChanged
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)