23 "(\\d+)x(\\d*)", QRegularExpression::CaseInsensitiveOption };
25 "-(\\d+)([dwmy])", QRegularExpression::CaseInsensitiveOption };
28 const QString& _prefix)
30 if (_prefix.isEmpty())
36 if (loaddefaultsettings)
203 matches = (matches ||
205 matches = (matches ||
207 matches = (matches ||
224 auto samegenre = [
this](
const auto & g) {
return g.first ==
m_genre; };
225 matches = std::any_of(gl.cbegin(), gl.cend(), samegenre);
231 auto samecountry = [
this](
const auto & c) {
return c.first ==
m_country; };
232 matches = std::any_of(cl.cbegin(), cl.cend(), samecountry);
245 auto samecast = [
this](
const auto & c){
return c.first ==
m_cast; };
246 matches = std::any_of(cl.cbegin(), cl.cend(), samecast);
259 matches = ((mdata.
GetYear() == 0) ||
348 LOG(VB_GENERAL, LOG_ERR, QString(
"Error: unknown sort type %1")
359 if (match.hasMatch())
361 m_season = match.capturedView(1).isEmpty()
362 ? -1 : match.capturedView(1).toInt();
363 m_episode = match.capturedView(2).isEmpty()
364 ? -1 : match.capturedView(2).toInt();
367 m_textFilter.remove(match.capturedStart(), match.capturedLength());
377 if (match.hasMatch())
379 int64_t modnr = match.capturedView(1).toInt();
381 switch(match.capturedView(2).at(0).toLatin1())
383 case 'd': testdate = testdate.addDays(-modnr);
break;
384 case 'w': testdate = testdate.addDays(-modnr * 7);
break;
385 case 'm': testdate = testdate.addMonths(-modnr);
break;
386 case 'y': testdate = testdate.addYears(-modnr);
break;
389 m_textFilter.remove(match.capturedStart(), match.capturedLength());
404 m_videoList(*video_list),
442 LOG(VB_GENERAL, LOG_ERR,
"Cannot load screen 'filter'");
501 bool have_unknown_year =
false;
502 bool have_unknown_runtime =
false;
504 using int_list = std::set<int>;
507 int_list user_ratings;
511 for (
const auto & md : mdl)
513 int year = md->GetYear();
515 have_unknown_year =
true;
519 std::chrono::minutes runtime = md->GetLength();
521 have_unknown_runtime =
true;
523 runtimes.insert(runtime.count() / 30);
525 user_ratings.insert(
static_cast<int>(md->GetUserRating()));
534 for (
const auto & vc : vcl)
545 for (
const auto & g : gl)
555 for (
const auto & c : cl)
565 for (
const auto & cn : cnl)
580 if (have_unknown_year)
589 if (have_unknown_runtime)
593 for (
int runtime : runtimes)
595 QString s = QString(
"%1 %2 ~ %3 %4").arg(runtime * 30).arg(tr(
"minutes"))
596 .arg((runtime + 1) * 30).arg(tr(
"minutes"));
606 for (
auto p = user_ratings.crbegin();
p != user_ratings.crend(); ++
p)
609 QString(
">= %1").arg(QString::number(*
p)),
619 QCoreApplication::translate(
"(Common)",
"Yes"), QVariant::fromValue(1));
621 QCoreApplication::translate(
"(Common)",
"No"), QVariant::fromValue(0));
628 QCoreApplication::translate(
"(Common)",
"Yes"), QVariant::fromValue(1));
630 QCoreApplication::translate(
"(Common)",
"No"), QVariant::fromValue(0));
649 QCoreApplication::translate(
"(Common)",
"Title"),
652 QCoreApplication::translate(
"(Common)",
"Season/Episode"),
655 QCoreApplication::translate(
"(Common)",
"Year"),
658 QCoreApplication::translate(
"(Common)",
"User Rating"),
661 QCoreApplication::translate(
"(Common)",
"Runtime"),
664 QCoreApplication::translate(
"(Common)",
"Filename"),
693 int new_year = item->
GetData().toInt();
void SaveSetting(const QString &key, int newValue)
int GetNumSetting(const QString &key, int defaultval=0)
Screen in which all other widgets are contained and rendered.
void BuildFocusList(void)
QString GetText(void) const
void SetText(const QString &text, bool moveCursor=true)
virtual void SetText(const QString &text)
const entry_list & getList()
std::vector< entry > entry_list
static VideoCast & GetCast()
static VideoCategory & GetCategory()
static VideoCountry & getCountry()
MythUIButton * m_doneButton
void SetUserRating(MythUIButtonListItem *item)
void setRunTime(MythUIButtonListItem *item)
void SetCoverFile(MythUIButtonListItem *item)
VideoFilterDialog(MythScreenStack *lparent, const QString &lname, VideoList *video_list)
void SetYear(MythUIButtonListItem *item)
MythUIButtonList * m_castList
void setCountry(MythUIButtonListItem *item)
MythUIButtonList * m_userRatingList
FilterSettingsProxy * m_fsp
void SetCategory(MythUIButtonListItem *item)
~VideoFilterDialog() override
MythUIText * m_numVideosText
MythUIButton * m_saveButton
MythUIButtonList * m_watchedList
void SetBrowse(MythUIButtonListItem *item)
MythUIButtonList * m_orderByList
void SetInetRef(MythUIButtonListItem *item)
MythUIButtonList * m_coverFileList
MythUIButtonList * m_genreList
void SetWatched(MythUIButtonListItem *item)
MythUIButtonList * m_yearList
void setOrderby(MythUIButtonListItem *item)
MythUIButtonList * m_categoryList
MythUIButtonList * m_inetRefList
MythUIButtonList * m_countryList
MythUIButtonList * m_runtimeList
MythUITextEdit * m_textFilter
const VideoList & m_videoList
void SetCast(MythUIButtonListItem *item)
MythUIButtonList * m_browseList
void setGenre(MythUIButtonListItem *item)
VideoFilterSettings m_settings
void setRuntime(int lruntime)
void SetInetRef(int inetref)
void SetUserRating(int luserrating)
void setGenre(int lgenre)
static const QRegularExpression kReSeason
VideoFilterSettings & operator=(const VideoFilterSettings &rhs)
static const QRegularExpression kReDate
void SetCategory(int lcategory)
void setCountry(int lcountry)
bool matches_filter(const VideoMetadata &mdata) const
@ kOrderByDateAddedDescending
@ kOrderByUserRatingDescending
unsigned int getChangedState()
unsigned int m_changedState
ParentalLevel::Level m_parentalLevel
bool meta_less_than(const VideoMetadata &lhs, const VideoMetadata &rhs) const
Compares two VideoMetadata instances.
@ kFilterUserRatingChanged
@ kFilterParentalLevelChanged
@ kFilterCoverFileChanged
@ kFilterTextFilterChanged
VideoFilterSettings(bool loaddefaultsettings=true, const QString &_prefix="")
void SetCoverFile(int coverfile)
QString getTextFilter() const
void SetBrowse(int lbrowse)
int GetUserRating() const
ordering getOrderby() const
void SetWatched(int lwatched)
void setOrderby(ordering lorderby)
void setTextFilter(const QString &val)
static VideoGenre & getGenre()
const VideoMetadataListManager & getListCache() const
int TryFilter(const VideoFilterSettings &filter) const
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
const QString VIDEO_INETREF_DEFAULT
const QString VIDEO_YEAR_UNKNOWN
const QString VIDEO_COUNTRY_UNKNOWN
const QString VIDEO_CATEGORY_UNKNOWN
const QString VIDEO_GENRE_UNKNOWN
const QString VIDEO_CAST_UNKNOWN
const QString VIDEO_RUNTIME_UNKNOWN
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
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)...
duration< CHRONO_TYPE, ratio< 31556952 > > years
virtual const VideoFilterSettings & getSettings()=0
virtual void setSettings(const VideoFilterSettings &settings)=0
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
bool IsDefaultCoverFile(const QString &coverfile)